diff options
Diffstat (limited to 'nvim/init.lua')
-rw-r--r-- | nvim/init.lua | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/nvim/init.lua b/nvim/init.lua index 7760aac..9d50ab3 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -24,4 +24,33 @@ vim.keymap.set('n', '<F6>', ':%!xxd <LF>') vim.cmd.highlight('SpellBad', 'ctermbg=Red') vim.cmd.highlight('SpellBad', 'ctermfg=Black') -require'lspconfig'.clangd.setup{} +local cmp = require'cmp' +cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, { + { name = 'buffer' }, + }) +}) + +local capabilities = require('cmp_nvim_lsp').default_capabilities() +require'lspconfig'.clangd.setup{ + capabilities = capabilities +} |