1
0
Fork 0

Compare commits

..

3 commits

Author SHA1 Message Date
Felipe Contreras-Salinas
c0e5b1749e
config refactor + ale -> nvim-lint 2023-03-27 16:09:35 -03:00
Felipe Contreras-Salinas
20c30c7283
vim-helm 2023-03-27 13:01:06 -03:00
Felipe Contreras-Salinas
fc99bab98d
More language servers 2023-03-27 12:59:11 -03:00
5 changed files with 59 additions and 58 deletions

9
.gitmodules vendored
View file

@ -1,6 +1,3 @@
[submodule "pack/general/start/ale"]
path = pack/general/start/ale
url = https://github.com/dense-analysis/ale
[submodule "pack/general/start/gruvbox.nvim"]
path = pack/general/start/gruvbox.nvim
url = https://github.com/npxbr/gruvbox.nvim
@ -82,3 +79,9 @@
[submodule "pack/general/start/nvim-dap-ui"]
path = pack/general/start/nvim-dap-ui
url = https://github.com/rcarriga/nvim-dap-ui
[submodule "pack/general/start/vim-helm"]
path = pack/general/start/vim-helm
url = https://github.com/towolf/vim-helm
[submodule "pack/general/start/nvim-lint"]
path = pack/general/start/nvim-lint
url = https://github.com/mfussenegger/nvim-lint

105
init.lua
View file

@ -2,7 +2,6 @@
local cmd = vim.cmd
local g = vim.g
local opt = vim.opt
local o = vim.o
---- General Config ----
opt.mouse = 'a'
@ -10,7 +9,6 @@ opt.tabstop = 4
opt.shiftwidth = 4
opt.number = true
opt.breakindent = true
--vim.o.inccomand = 'nosplit'
opt.showmatch = true
opt.ignorecase = true
opt.smartcase = true
@ -25,11 +23,14 @@ opt.shortmess:append({ I = true })
--opt.whichwrap = {'<','>','[',']'}
opt.cmdheight = 2
opt.showcmd = true
opt.showcmd = true
g.mapleader = ' '
---- Terminal ----
cmd 'autocmd TermOpen * setlocal nonumber'
vim.api.nvim_create_autocmd({ "TermOpen" }, {
callback = function()
vim.l.number = false
end,
})
---- Theming ----
opt.termguicolors = true
@ -55,10 +56,10 @@ local function map(mode, lhs, rhs, opts)
if opts then options = vim.tbl_extend('force', options, opts) end
vim.keymap.set(mode, lhs, rhs, options)
end
map('!','<C-BS>','<C-w>')
map('v','>','>gv')
map('v','<','<gv')
map('n','<C-L>',':nohlsearch<CR>')
vim.keymap.set('!','<C-BS>','<C-w>')
vim.keymap.set('v','>','>gv')
vim.keymap.set('v','<','<gv')
vim.keymap.set('n','<C-L>',':nohlsearch<CR>')
---- Treesitter ----
local ts = require 'nvim-treesitter.configs'
@ -140,9 +141,12 @@ end
local servers = {
'clangd',
'gopls',
'jsonls',
'kotlin_language_server',
'marksman',
'rust_analyzer',
'texlab',
'tflint',
'tsserver',
'pylsp'
}
@ -150,36 +154,34 @@ local servers = {
-- overrides the previous calls.
-- Auto format on save
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
callback = function()
vim.lsp.buf.format()
end,
})
---- Plugins ----
---- ale
g.ale_linters = {
bash = {'shellcheck'},
c = {},
cpp = {},
css = {'stylelint'},
go = {'gobuild', 'golangci-lint'},
html = {'tidy'},
javascript = {'eslint'},
python = {'flake8', 'isort'},
terraform = {'tflint'},
tex = {},
typescript = {},
vim = {'vint'},
zsh = {'shell', 'shellcheck'},
}
g.ale_sign_error = ''
g.ale_sign_warning = ''
g.ale_set_highlights = 1
-- Go
g.ale_go_golangci_lint_options = ''
g.ale_go_golangci_lint_package = 1
-- Mappings
map('n', '[W', '<Plug>(ale_first)')
map('n', '[w', '<Plug>(ale_previous_wrap)')
map('n', ']w', '<Plug>(ale_next_wrap)')
map('n', ']W', '<Plug>(ale_last)')
---- nvim-lint ----
local lint = require 'lint'
linters = {
bash = {'shellcheck'},
go = {'golangcilint',},
python = {'flake8'},
yaml = {'yamllint'},
zsh = {'shellcheck'},
}
-- set linters --
lint.linters_by_ft = linters
-- set autocommands --
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
lint.try_lint()
end,
})
---- completion-nvim
local cmp = require'cmp'
@ -209,11 +211,12 @@ cmp.setup({
})
})
--cmd [[autocmd FileType *\(TelescopePrompt\)\@<! lua require'completion'.on_attach()]]
-- Setup lspconfig.
local capabilities = vim.lsp.protocol.make_client_capabilities()
lsp.util.default_config = vim.tbl_deep_extend(
'force', lsp.util.default_config, { capabilities = capabilities, })
for _, server in ipairs(servers) do
for _, server in pairs(servers) do
lsp[server].setup {
on_attach = on_lsp_attach,
flags = {
@ -228,40 +231,34 @@ require('gitsigns').setup {
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
vim.keymap.set('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true})
map('n', '[c', function()
vim.keymap.set('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true})
-- Actions
map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
map('n', '<leader>hS', gs.stage_buffer)
map('n', '<leader>hu', gs.undo_stage_hunk)
map('n', '<leader>hR', gs.reset_buffer)
map('n', '<leader>hp', gs.preview_hunk)
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
map('n', '<leader>tb', gs.toggle_current_line_blame)
map('n', '<leader>hd', gs.diffthis)
map('n', '<leader>hD', function() gs.diffthis('~') end)
map('n', '<leader>td', gs.toggle_deleted)
vim.keymap.set({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
vim.keymap.set({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
vim.keymap.set('n', '<leader>hS', gs.stage_buffer)
vim.keymap.set('n', '<leader>hu', gs.undo_stage_hunk)
vim.keymap.set('n', '<leader>hR', gs.reset_buffer)
vim.keymap.set('n', '<leader>hp', gs.preview_hunk)
vim.keymap.set('n', '<leader>hb', function() gs.blame_line{full=true} end)
vim.keymap.set('n', '<leader>tb', gs.toggle_current_line_blame)
vim.keymap.set('n', '<leader>hd', gs.diffthis)
vim.keymap.set('n', '<leader>hD', function() gs.diffthis('~') end)
vim.keymap.set('n', '<leader>td', gs.toggle_deleted)
-- Text object
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
vim.keymap.set({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
end
}
---- Comment.nvim

@ -1 +0,0 @@
Subproject commit 7dbd3c96ac1eb3a1981e740423a31500108f6e25

@ -0,0 +1 @@
Subproject commit b16e6e424ddfb12d4b3a699c1dc41ba0f3b503da

@ -0,0 +1 @@
Subproject commit c2e7b85711d410e1d73e64eb5df7b70b1c4c10eb