simplify neovim config to use native lsp and dap with minimal plugins
This commit is contained in:
@@ -1,26 +1,18 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "1f4ad8bb72bdeb60975e98652636b991a9b7475d" },
|
||||
"auto-dark-mode.nvim": { "branch": "main", "commit": "54058b4fe414bd64bd2904a6f8a63f1f14e3d8df" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "7c4faa3540d0781a28588cafbd4dd187a28ac6e3" },
|
||||
"helm-ls.nvim": { "branch": "main", "commit": "f0b9a1723890971a6d84890b50dbf5f40974ea1b" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "31d6fb2d618bca1482b9f274751ead5f03461408" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"mason.nvim": { "branch": "main", "commit": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d" },
|
||||
"nnn.nvim": { "branch": "master", "commit": "efe690293eee87558f034a83ed96157e52639cdb" },
|
||||
"nvim": { "branch": "main", "commit": "7365b8dede43a82ed1df741275b75333422e5402" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
|
||||
"nvim-dap": { "branch": "master", "commit": "a9d8cb68ee7184111dc66156c4a2ebabfbe01bc5" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" },
|
||||
"nvim-dap": { "branch": "master", "commit": "9e848e09a697ee95302a3ef2dd43fd6eb709e570" },
|
||||
"nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "0203a9608d63eda57679b01e69f33a7b4c34b0d1" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "9197f3ee3f0c9a754aab5b16500db6d7da5f68fd" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
||||
"orgmode": { "branch": "master", "commit": "9deee54eb3dfc0fc2aebb3346c317ed198f423cb" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "cc9dd33aade7f20bae414d0cba163bc60d4d4b43" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "7ab79bb1b57160a537f427ac8a6026102f12b701" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "4213bd6eabac38b16dd6615002b6243b23cf3bf6" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "61df84986b4b4ec469ee745a182e433d49f8c27e" },
|
||||
"orgmode": { "branch": "master", "commit": "f32a06d4b5399dad8bf0478c772bf6c513f02dcf" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "427b576c16792edad01a92b89721d923c19ad60f" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "8564ce6d29ec7554eb9df578efa882d33b3c23a7" }
|
||||
}
|
||||
|
||||
+38
-104
@@ -1,12 +1,4 @@
|
||||
-- Add additional capabilities supported by nvim-cmp
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
vim.lsp.config('*', {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- Enable some language servers with the additional completion capabilities
|
||||
-- Enable language servers
|
||||
local servers = { 'lua_ls', 'pyright', 'gopls', 'clangd', 'helm_ls', 'bashls', 'angularls', 'djls' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
vim.lsp.enable(lsp)
|
||||
@@ -63,102 +55,44 @@ vim.lsp.config('yamlls', {
|
||||
})
|
||||
vim.lsp.enable('yamlls')
|
||||
|
||||
|
||||
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
|
||||
pattern = "*.jenkinsfile",
|
||||
command = "set filetype=groovy"
|
||||
})
|
||||
|
||||
-- luasnip setup
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require('cmp')
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
|
||||
-- C-b (back) C-f (forward) for snippet placeholder navigation.
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'orgmode' },
|
||||
},
|
||||
window = {
|
||||
completion = {
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
winhighlight = 'Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
|
||||
},
|
||||
documentation = {
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
winhighlight = 'Normal:Normal,FloatBorder:FloatBorder'
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
vim.o.winborder = "rounded"
|
||||
-- DAP Setup
|
||||
-- require('dap-python').setup('~/venv/bin/python')
|
||||
-- require('dap-go').setup()
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||
vim.api.nvim_set_keymap('i', '<c-n>', '<c-x><c-o>', { noremap = true, silent = true })
|
||||
-- vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||
-- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
-- vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
-- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||
-- vim.api.nvim_set_keymap('i', '<c-n>', '<c-x><c-o>', { noremap = true, silent = true })
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
--- Use LspAttach autocommand to only map the following keys
|
||||
--- after the language server attaches to the current buffer
|
||||
-- vim.api.nvim_create_autocmd('LspAttach', {
|
||||
-- group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
-- callback = function(ev)
|
||||
-- -- Enable completion triggered by <c-x><c-o>
|
||||
-- vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
--
|
||||
-- -- Buffer local mappings.
|
||||
-- -- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
-- local opts = { buffer = ev.buf }
|
||||
-- vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
-- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
-- vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
-- vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
-- vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
-- vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
-- vim.keymap.set('n', '<space>wl', function()
|
||||
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
-- end, opts)
|
||||
-- vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
-- vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
-- vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
-- vim.keymap.set('n', '<space>f', function()
|
||||
-- vim.lsp.buf.format { async = true }
|
||||
-- end, opts)
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
@@ -13,17 +13,14 @@ vim.api.nvim_set_keymap('n', '<C-f>', ':NnnPicker %:p:h<CR>', { noremap = true }
|
||||
vim.api.nvim_set_keymap('t', '<C-f>', '<cmd>NnnPicker %:p:h<CR>', { noremap = true })
|
||||
|
||||
-- nvim-tree
|
||||
vim.api.nvim_set_keymap('n', '<C-b>', '<cmd>NvimTreeToggle <CR>', { noremap = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>b', ':NvimTreeResize ', { noremap = true })
|
||||
-- vim.api.nvim_set_keymap('n', '<C-b>', '<cmd>NvimTreeToggle <CR>', { noremap = true })
|
||||
-- vim.api.nvim_set_keymap('n', '<leader>b', ':NvimTreeResize ', { noremap = true })
|
||||
|
||||
-- Telescope
|
||||
vim.keymap.set('n', '<C-l>', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<C-k>', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<C-p>', builtin.commands, {})
|
||||
|
||||
-- etc
|
||||
vim.keymap.set('n', '?', ':WhichKey<CR>', {})
|
||||
|
||||
-- zen mode
|
||||
vim.keymap.set('n', '<leader>z', ':ZenMode<CR>', { silent = true })
|
||||
|
||||
@@ -52,11 +49,3 @@ vim.keymap.set('n', '<F10>', function() require('dap').step_over() end)
|
||||
vim.keymap.set('n', '<F11>', function() require('dap').step_into() end)
|
||||
vim.keymap.set('n', '<F12>', function() require('dap').step_out() end)
|
||||
vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end)
|
||||
|
||||
-- Copilot
|
||||
vim.api.nvim_set_keymap('n', '<C-C>', ':CopilotChatToggle <CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-J>', 'copilot#Accept("<CR>")', { expr=true, noremap = true, silent = true })
|
||||
vim.keymap.set('i', '<C-H>', '<Plug>(copilot-accept-word)', { noremap=true, silent=true })
|
||||
vim.keymap.set("i", "<C-U>", '<Plug>(copilot-next)', { noremap=true, silent=true })
|
||||
vim.keymap.set("i", "<C-B>", '<Plug>(copilot-previous)', { noremap=true, silent=true })
|
||||
vim.g.copilot_no_tab_map = true
|
||||
|
||||
@@ -14,19 +14,11 @@ vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Install Plugins
|
||||
require('lazy').setup({
|
||||
-- Core
|
||||
'williamboman/mason.nvim',
|
||||
-- LSP
|
||||
'neovim/nvim-lspconfig',
|
||||
'hrsh7th/nvim-cmp',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'folke/neodev.nvim',
|
||||
'qvalentin/helm-ls.nvim',
|
||||
{ 'L3MON4D3/LuaSnip', version = 'v2.1.0' },
|
||||
-- DAP
|
||||
'mfussenegger/nvim-dap',
|
||||
'rcarriga/nvim-dap-ui',
|
||||
'nvim-neotest/nvim-nio',
|
||||
'leoluz/nvim-dap-go',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'luukvbaal/nnn.nvim',
|
||||
@@ -108,8 +100,6 @@ require('lazy').setup({
|
||||
})
|
||||
|
||||
-- Initialize Plugins
|
||||
require("mason").setup()
|
||||
require('neodev').setup()
|
||||
-- require("tree-sitter-manager").setup()
|
||||
require('nnn').setup({
|
||||
picker = {
|
||||
@@ -118,28 +108,28 @@ require('nnn').setup({
|
||||
fullscreen = false,
|
||||
},
|
||||
})
|
||||
local function tree_on_attach(bufnr)
|
||||
local api = require('nvim-tree.api')
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
vim.keymap.del('n', '<C-e>', { buffer = bufnr })
|
||||
vim.keymap.set("n", "<M-h>", function() api.tree.resize({ relative = -5 }) end, { buffer = bufnr })
|
||||
vim.keymap.set("n", "<M-l>", function() api.tree.resize({ relative = 5 }) end, { buffer = bufnr })
|
||||
end
|
||||
require('nvim-tree').setup({
|
||||
on_attach = tree_on_attach,
|
||||
renderer = {
|
||||
full_name = true,
|
||||
},
|
||||
view = {
|
||||
side = "left",
|
||||
},
|
||||
tab = {
|
||||
sync = {
|
||||
open = true,
|
||||
close = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
-- local function tree_on_attach(bufnr)
|
||||
-- local api = require('nvim-tree.api')
|
||||
-- api.config.mappings.default_on_attach(bufnr)
|
||||
-- vim.keymap.del('n', '<C-e>', { buffer = bufnr })
|
||||
-- vim.keymap.set("n", "<M-h>", function() api.tree.resize({ relative = -5 }) end, { buffer = bufnr })
|
||||
-- vim.keymap.set("n", "<M-l>", function() api.tree.resize({ relative = 5 }) end, { buffer = bufnr })
|
||||
-- end
|
||||
-- require('nvim-tree').setup({
|
||||
-- on_attach = tree_on_attach,
|
||||
-- renderer = {
|
||||
-- full_name = true,
|
||||
-- },
|
||||
-- view = {
|
||||
-- side = "left",
|
||||
-- },
|
||||
-- tab = {
|
||||
-- sync = {
|
||||
-- open = true,
|
||||
-- close = true,
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
require('telescope').setup({
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
@@ -157,8 +147,3 @@ require('telescope').setup({
|
||||
})
|
||||
require("telescope").load_extension("ui-select")
|
||||
require('nvim-autopairs').setup()
|
||||
-- require('which-key').setup()
|
||||
|
||||
-- DAP Setup
|
||||
-- require('dap-python').setup('~/venv/bin/python')
|
||||
require('dap-go').setup()
|
||||
|
||||
@@ -10,22 +10,8 @@ vim.wo.number = true
|
||||
vim.wo.relativenumber = true
|
||||
vim.g.mapleader = ' '
|
||||
vim.o.splitright = true
|
||||
vim.o.maxmempattern = 100000
|
||||
|
||||
-- Highlighting for orgmode files with highlight.nvim
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
callback = function()
|
||||
local cursorline = vim.api.nvim_get_hl(0, { name = "CursorLine" })
|
||||
local sep = vim.api.nvim_get_hl(0, { name = "WinSeparator" }).fg
|
||||
or vim.api.nvim_get_hl(0, { name = "Comment" }).fg
|
||||
|
||||
vim.api.nvim_set_hl(0, "Headline1", { bg = cursorline.bg, underline = true, sp = sep })
|
||||
vim.api.nvim_set_hl(0, "Headline2", { bg = cursorline.bg, underline = true, sp = sep })
|
||||
vim.api.nvim_set_hl(0, "Headline3", { bg = cursorline.bg, underline = true, sp = sep })
|
||||
vim.api.nvim_set_hl(0, "Headline4", { bg = cursorline.bg, underline = true, sp = sep })
|
||||
end,
|
||||
})
|
||||
|
||||
-- Global colorscheme based on terminal colors
|
||||
vim.cmd([[
|
||||
autocmd ColorScheme * highlight Statement cterm=bold ctermfg=5
|
||||
autocmd ColorScheme * highlight Keyword ctermfg=5
|
||||
@@ -36,8 +22,45 @@ vim.cmd([[
|
||||
autocmd ColorScheme * highlight Comment cterm=italic ctermfg=lightgray
|
||||
autocmd ColorScheme * highlight Visual cterm=reverse ctermfg=NONE ctermbg=NONE
|
||||
|
||||
" Completion popup
|
||||
autocmd ColorScheme * highlight! link Pmenu Normal
|
||||
autocmd ColorScheme * highlight! link PmenuKind Normal
|
||||
autocmd ColorScheme * highlight! link PmenuExtra Normal
|
||||
autocmd ColorScheme * highlight! link PmenuMatch Normal
|
||||
autocmd ColorScheme * highlight! link PmenuBorder Normal
|
||||
|
||||
" Selected completion
|
||||
autocmd ColorScheme * highlight! PmenuSel cterm=reverse ctermfg=NONE ctermbg=NONE
|
||||
autocmd ColorScheme * highlight! link PmenuKindSel PmenuSel
|
||||
autocmd ColorScheme * highlight! link PmenuExtraSel PmenuSel
|
||||
autocmd ColorScheme * highlight! link PmenuMatchSel PmenuSel
|
||||
|
||||
" Documentation and other floating windows
|
||||
autocmd ColorScheme * highlight! link NormalFloat Normal
|
||||
autocmd ColorScheme * highlight! link FloatBorder Normal
|
||||
|
||||
syntax on
|
||||
set notermguicolors
|
||||
set pumborder=rounded
|
||||
set winborder=rounded
|
||||
colorscheme default
|
||||
]])
|
||||
|
||||
-- Global colorscheme based on terminal colors
|
||||
-- vim.cmd([[
|
||||
-- autocmd ColorScheme * highlight Statement cterm=bold ctermfg=5
|
||||
-- autocmd ColorScheme * highlight Keyword ctermfg=5
|
||||
-- autocmd ColorScheme * highlight Type ctermfg=6
|
||||
-- autocmd ColorScheme * highlight Function cterm=bold ctermfg=4
|
||||
-- autocmd ColorScheme * highlight Constant ctermfg=3
|
||||
-- autocmd ColorScheme * highlight String ctermfg=2
|
||||
-- autocmd ColorScheme * highlight Comment cterm=italic ctermfg=lightgray
|
||||
-- autocmd ColorScheme * highlight Visual cterm=reverse ctermfg=NONE ctermbg=NONE
|
||||
--
|
||||
-- syntax on
|
||||
-- set notermguicolors
|
||||
-- colorscheme default
|
||||
-- ]])
|
||||
-- autocmd ColorScheme * highlight Folded cterm=italic ctermfg=lightgray ctermbg=18
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user