This commit is contained in:
2023-05-21 21:50:34 +02:00
commit 6d37d8b3ae
6 changed files with 207 additions and 0 deletions

25
lua/code-completion.lua Normal file
View File

@ -0,0 +1,25 @@
vim.opt.completeopt = { 'menuone', 'noselect', 'noinsert', 'preview' }
vim.opt.shortmess = vim.opt.shortmess + { c = true }
local cmp = require'cmp'
cmp.setup({
mapping = {
['<S-Tab>'] = cmp.mapping.select_prev_item(),
['<Tab>'] = cmp.mapping.select_next_item(),
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
})
},
sources = {
{ name = 'path' },
{ name = 'nvim_lsp', keyword_length = 3 },
{ name = 'nvim_lsp_signature_help' },
{ name = 'nvim_lua', keyword_length = 2 },
{ name = 'buffer', keyword_length = 2 },
}
})