diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-11-07 13:39:23 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-11-07 13:42:36 +0100 |
commit | 9bbe0077104e5e0dab8b1a8f197f7ce9bb240be4 (patch) | |
tree | d481d1ad6a50d7dc17f0f0f4a023806514295db9 /.config/nvim/after/plugin/nvim-cmp.lua | |
parent | 26e9302a62b7461ebffda8ae9a56025a90658194 (diff) |
nvim: Make LSP config more minimal
Diffstat (limited to '.config/nvim/after/plugin/nvim-cmp.lua')
-rw-r--r-- | .config/nvim/after/plugin/nvim-cmp.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/.config/nvim/after/plugin/nvim-cmp.lua b/.config/nvim/after/plugin/nvim-cmp.lua new file mode 100644 index 0000000..4bc95c5 --- /dev/null +++ b/.config/nvim/after/plugin/nvim-cmp.lua @@ -0,0 +1,31 @@ +local conf = require('lspconfig') +local capabilities = require('cmp_nvim_lsp').default_capabilities() +conf['clangd'].setup { capabilities = capabilities } +conf['gopls'].setup { capabilities = capabilities } +conf['lua_ls'].setup { capabilities = capabilities } +conf['rust_analyzer'].setup { capabilities = capabilities } + +local cmp = require('cmp') +cmp.setup { + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + ['<C-k>'] = cmp.mapping.select_prev_item(), + ['<C-j>'] = cmp.mapping.select_next_item(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'path' }, + { name = 'luasnip' }, + }, { + { name = 'buffer', length = 5 }, + }), + experimental = { + ghost_text = true, + } +} |