1
0
Fork 0

Compare commits

..

No commits in common. "c0e5b1749e17f323ceb20f1028e67fc95c5ff6ab" and "828a94da2ec583faf903093293f63c33995e44d8" have entirely different histories.

5 changed files with 58 additions and 59 deletions

9
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[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
@ -79,9 +82,3 @@
[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
View file

@ -2,6 +2,7 @@
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'
@ -9,6 +10,7 @@ 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
@ -23,14 +25,11 @@ 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 ----
vim.api.nvim_create_autocmd({ "TermOpen" }, { cmd 'autocmd TermOpen * setlocal nonumber'
callback = function()
vim.l.number = false
end,
})
---- Theming ---- ---- Theming ----
opt.termguicolors = true opt.termguicolors = true
@ -56,10 +55,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
vim.keymap.set('!','<C-BS>','<C-w>') map('!','<C-BS>','<C-w>')
vim.keymap.set('v','>','>gv') map('v','>','>gv')
vim.keymap.set('v','<','<gv') map('v','<','<gv')
vim.keymap.set('n','<C-L>',':nohlsearch<CR>') map('n','<C-L>',':nohlsearch<CR>')
---- Treesitter ---- ---- Treesitter ----
local ts = require 'nvim-treesitter.configs' local ts = require 'nvim-treesitter.configs'
@ -141,12 +140,9 @@ 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'
} }
@ -154,34 +150,36 @@ local servers = {
-- overrides the previous calls. -- overrides the previous calls.
-- Auto format on save -- Auto format on save
vim.api.nvim_create_autocmd({ "BufWritePre" }, { vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
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
---- nvim-lint ---- -- Mappings
local lint = require 'lint' map('n', '[W', '<Plug>(ale_first)')
linters = { map('n', '[w', '<Plug>(ale_previous_wrap)')
bash = {'shellcheck'}, map('n', ']w', '<Plug>(ale_next_wrap)')
go = {'golangcilint',}, map('n', ']W', '<Plug>(ale_last)')
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'
@ -211,12 +209,11 @@ 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 pairs(servers) do for _, server in ipairs(servers) do
lsp[server].setup { lsp[server].setup {
on_attach = on_lsp_attach, on_attach = on_lsp_attach,
flags = { flags = {
@ -231,34 +228,40 @@ 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
vim.keymap.set('n', ']c', function() map('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})
vim.keymap.set('n', '[c', function() map('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
vim.keymap.set({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>') map({'n', 'v'}, '<leader>hs', ':Gitsigns stage_hunk<CR>')
vim.keymap.set({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>') map({'n', 'v'}, '<leader>hr', ':Gitsigns reset_hunk<CR>')
vim.keymap.set('n', '<leader>hS', gs.stage_buffer) map('n', '<leader>hS', gs.stage_buffer)
vim.keymap.set('n', '<leader>hu', gs.undo_stage_hunk) map('n', '<leader>hu', gs.undo_stage_hunk)
vim.keymap.set('n', '<leader>hR', gs.reset_buffer) map('n', '<leader>hR', gs.reset_buffer)
vim.keymap.set('n', '<leader>hp', gs.preview_hunk) map('n', '<leader>hp', gs.preview_hunk)
vim.keymap.set('n', '<leader>hb', function() gs.blame_line{full=true} end) map('n', '<leader>hb', function() gs.blame_line{full=true} end)
vim.keymap.set('n', '<leader>tb', gs.toggle_current_line_blame) map('n', '<leader>tb', gs.toggle_current_line_blame)
vim.keymap.set('n', '<leader>hd', gs.diffthis) map('n', '<leader>hd', gs.diffthis)
vim.keymap.set('n', '<leader>hD', function() gs.diffthis('~') end) map('n', '<leader>hD', function() gs.diffthis('~') end)
vim.keymap.set('n', '<leader>td', gs.toggle_deleted) map('n', '<leader>td', gs.toggle_deleted)
-- Text object -- Text object
vim.keymap.set({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>') map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
end end
} }
---- Comment.nvim ---- Comment.nvim

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

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

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