Compare commits
3 commits
828a94da2e
...
c0e5b1749e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0e5b1749e | ||
|
|
20c30c7283 | ||
|
|
fc99bab98d |
5 changed files with 59 additions and 58 deletions
9
.gitmodules
vendored
9
.gitmodules
vendored
|
|
@ -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"]
|
[submodule "pack/general/start/gruvbox.nvim"]
|
||||||
path = pack/general/start/gruvbox.nvim
|
path = pack/general/start/gruvbox.nvim
|
||||||
url = https://github.com/npxbr/gruvbox.nvim
|
url = https://github.com/npxbr/gruvbox.nvim
|
||||||
|
|
@ -82,3 +79,9 @@
|
||||||
[submodule "pack/general/start/nvim-dap-ui"]
|
[submodule "pack/general/start/nvim-dap-ui"]
|
||||||
path = pack/general/start/nvim-dap-ui
|
path = pack/general/start/nvim-dap-ui
|
||||||
url = https://github.com/rcarriga/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
105
init.lua
|
|
@ -2,7 +2,6 @@
|
||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local o = vim.o
|
|
||||||
|
|
||||||
---- General Config ----
|
---- General Config ----
|
||||||
opt.mouse = 'a'
|
opt.mouse = 'a'
|
||||||
|
|
@ -10,7 +9,6 @@ opt.tabstop = 4
|
||||||
opt.shiftwidth = 4
|
opt.shiftwidth = 4
|
||||||
opt.number = true
|
opt.number = true
|
||||||
opt.breakindent = true
|
opt.breakindent = true
|
||||||
--vim.o.inccomand = 'nosplit'
|
|
||||||
opt.showmatch = true
|
opt.showmatch = true
|
||||||
opt.ignorecase = true
|
opt.ignorecase = true
|
||||||
opt.smartcase = true
|
opt.smartcase = true
|
||||||
|
|
@ -25,11 +23,14 @@ opt.shortmess:append({ I = true })
|
||||||
--opt.whichwrap = {'<','>','[',']'}
|
--opt.whichwrap = {'<','>','[',']'}
|
||||||
opt.cmdheight = 2
|
opt.cmdheight = 2
|
||||||
opt.showcmd = true
|
opt.showcmd = true
|
||||||
opt.showcmd = true
|
|
||||||
g.mapleader = ' '
|
g.mapleader = ' '
|
||||||
|
|
||||||
---- Terminal ----
|
---- Terminal ----
|
||||||
cmd 'autocmd TermOpen * setlocal nonumber'
|
vim.api.nvim_create_autocmd({ "TermOpen" }, {
|
||||||
|
callback = function()
|
||||||
|
vim.l.number = false
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
---- Theming ----
|
---- Theming ----
|
||||||
opt.termguicolors = true
|
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
|
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||||
vim.keymap.set(mode, lhs, rhs, options)
|
vim.keymap.set(mode, lhs, rhs, options)
|
||||||
end
|
end
|
||||||
map('!','<C-BS>','<C-w>')
|
vim.keymap.set('!','<C-BS>','<C-w>')
|
||||||
map('v','>','>gv')
|
vim.keymap.set('v','>','>gv')
|
||||||
map('v','<','<gv')
|
vim.keymap.set('v','<','<gv')
|
||||||
map('n','<C-L>',':nohlsearch<CR>')
|
vim.keymap.set('n','<C-L>',':nohlsearch<CR>')
|
||||||
|
|
||||||
---- Treesitter ----
|
---- Treesitter ----
|
||||||
local ts = require 'nvim-treesitter.configs'
|
local ts = require 'nvim-treesitter.configs'
|
||||||
|
|
@ -140,9 +141,12 @@ end
|
||||||
local servers = {
|
local servers = {
|
||||||
'clangd',
|
'clangd',
|
||||||
'gopls',
|
'gopls',
|
||||||
|
'jsonls',
|
||||||
'kotlin_language_server',
|
'kotlin_language_server',
|
||||||
|
'marksman',
|
||||||
'rust_analyzer',
|
'rust_analyzer',
|
||||||
'texlab',
|
'texlab',
|
||||||
|
'tflint',
|
||||||
'tsserver',
|
'tsserver',
|
||||||
'pylsp'
|
'pylsp'
|
||||||
}
|
}
|
||||||
|
|
@ -150,36 +154,34 @@ local servers = {
|
||||||
-- overrides the previous calls.
|
-- overrides the previous calls.
|
||||||
|
|
||||||
-- Auto format on save
|
-- 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 ----
|
---- 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
|
-- Go
|
||||||
g.ale_go_golangci_lint_options = ''
|
g.ale_go_golangci_lint_options = ''
|
||||||
g.ale_go_golangci_lint_package = 1
|
g.ale_go_golangci_lint_package = 1
|
||||||
-- Mappings
|
---- nvim-lint ----
|
||||||
map('n', '[W', '<Plug>(ale_first)')
|
local lint = require 'lint'
|
||||||
map('n', '[w', '<Plug>(ale_previous_wrap)')
|
linters = {
|
||||||
map('n', ']w', '<Plug>(ale_next_wrap)')
|
bash = {'shellcheck'},
|
||||||
map('n', ']W', '<Plug>(ale_last)')
|
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
|
---- completion-nvim
|
||||||
local cmp = require'cmp'
|
local cmp = require'cmp'
|
||||||
|
|
||||||
|
|
@ -209,11 +211,12 @@ cmp.setup({
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
--cmd [[autocmd FileType *\(TelescopePrompt\)\@<! lua require'completion'.on_attach()]]
|
--cmd [[autocmd FileType *\(TelescopePrompt\)\@<! lua require'completion'.on_attach()]]
|
||||||
|
|
||||||
-- Setup lspconfig.
|
-- Setup lspconfig.
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
lsp.util.default_config = vim.tbl_deep_extend(
|
lsp.util.default_config = vim.tbl_deep_extend(
|
||||||
'force', lsp.util.default_config, { capabilities = capabilities, })
|
'force', lsp.util.default_config, { capabilities = capabilities, })
|
||||||
for _, server in ipairs(servers) do
|
for _, server in pairs(servers) do
|
||||||
lsp[server].setup {
|
lsp[server].setup {
|
||||||
on_attach = on_lsp_attach,
|
on_attach = on_lsp_attach,
|
||||||
flags = {
|
flags = {
|
||||||
|
|
@ -228,40 +231,34 @@ require('gitsigns').setup {
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
local gs = package.loaded.gitsigns
|
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
|
-- Navigation
|
||||||
map('n', ']c', function()
|
vim.keymap.set('n', ']c', function()
|
||||||
if vim.wo.diff then return ']c' end
|
if vim.wo.diff then return ']c' end
|
||||||
vim.schedule(function() gs.next_hunk() end)
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end, {expr=true})
|
end, {expr=true})
|
||||||
|
|
||||||
map('n', '[c', function()
|
vim.keymap.set('n', '[c', function()
|
||||||
if vim.wo.diff then return '[c' end
|
if vim.wo.diff then return '[c' end
|
||||||
vim.schedule(function() gs.prev_hunk() end)
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end, {expr=true})
|
end, {expr=true})
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
vim.keymap.set({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||||
map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
vim.keymap.set({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||||
map('n', '<leader>hS', gs.stage_buffer)
|
vim.keymap.set('n', '<leader>hS', gs.stage_buffer)
|
||||||
map('n', '<leader>hu', gs.undo_stage_hunk)
|
vim.keymap.set('n', '<leader>hu', gs.undo_stage_hunk)
|
||||||
map('n', '<leader>hR', gs.reset_buffer)
|
vim.keymap.set('n', '<leader>hR', gs.reset_buffer)
|
||||||
map('n', '<leader>hp', gs.preview_hunk)
|
vim.keymap.set('n', '<leader>hp', gs.preview_hunk)
|
||||||
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
|
vim.keymap.set('n', '<leader>hb', function() gs.blame_line{full=true} end)
|
||||||
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
vim.keymap.set('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||||
map('n', '<leader>hd', gs.diffthis)
|
vim.keymap.set('n', '<leader>hd', gs.diffthis)
|
||||||
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
vim.keymap.set('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||||
map('n', '<leader>td', gs.toggle_deleted)
|
vim.keymap.set('n', '<leader>td', gs.toggle_deleted)
|
||||||
|
|
||||||
-- Text object
|
-- 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
|
end
|
||||||
}
|
}
|
||||||
---- Comment.nvim
|
---- Comment.nvim
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 7dbd3c96ac1eb3a1981e740423a31500108f6e25
|
|
||||||
1
pack/general/start/nvim-lint
Submodule
1
pack/general/start/nvim-lint
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit b16e6e424ddfb12d4b3a699c1dc41ba0f3b503da
|
||||||
1
pack/general/start/vim-helm
Submodule
1
pack/general/start/vim-helm
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit c2e7b85711d410e1d73e64eb5df7b70b1c4c10eb
|
||||||
Loading…
Add table
Reference in a new issue