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"]
path = pack/general/start/gruvbox.nvim
url = https://github.com/npxbr/gruvbox.nvim
@ -79,9 +82,3 @@
[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,6 +2,7 @@
local cmd = vim.cmd
local g = vim.g
local opt = vim.opt
local o = vim.o
---- General Config ----
opt.mouse = 'a'
@ -9,6 +10,7 @@ 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
@ -23,14 +25,11 @@ opt.shortmess:append({ I = true })
--opt.whichwrap = {'<','>','[',']'}
opt.cmdheight = 2
opt.showcmd = true
opt.showcmd = true
g.mapleader = ' '
---- Terminal ----
vim.api.nvim_create_autocmd({ "TermOpen" }, {
callback = function()
vim.l.number = false
end,
})
cmd 'autocmd TermOpen * setlocal nonumber'
---- Theming ----
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
vim.keymap.set(mode, lhs, rhs, options)
end
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>')
map('!','<C-BS>','<C-w>')
map('v','>','>gv')
map('v','<','<gv')
map('n','<C-L>',':nohlsearch<CR>')
---- Treesitter ----
local ts = require 'nvim-treesitter.configs'
@ -141,12 +140,9 @@ end
local servers = {
'clangd',
'gopls',
'jsonls',
'kotlin_language_server',
'marksman',
'rust_analyzer',
'texlab',
'tflint',
'tsserver',
'pylsp'
}
@ -154,34 +150,36 @@ local servers = {
-- overrides the previous calls.
-- Auto format on save
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
callback = function()
vim.lsp.buf.format()
end,
})
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
---- 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
---- 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,
})
-- 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)')
---- completion-nvim
local cmp = require'cmp'
@ -211,12 +209,11 @@ 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 pairs(servers) do
for _, server in ipairs(servers) do
lsp[server].setup {
on_attach = on_lsp_attach,
flags = {
@ -231,34 +228,40 @@ 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
vim.keymap.set('n', ']c', function()
map('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true})
vim.keymap.set('n', '[c', function()
map('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true})
-- Actions
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)
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)
-- 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
}
---- Comment.nvim

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

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

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