nvim: added completion engine

This commit is contained in:
dogeystamp 2023-04-12 18:49:17 -04:00
parent 1100fc0755
commit 58cad94a41
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
2 changed files with 23 additions and 1 deletions

View File

@ -161,8 +161,11 @@ if has('python3')
" my devices without python3 probably don't need these
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/completion-nvim'
Plug 'nvim-lua/lsp-status.nvim'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'stevearc/dressing.nvim'
endif

View File

@ -97,3 +97,22 @@ require('leap').opts.labels = { "a", "s", "d",
"f", "k", "l", "h", "o", "d", "w", "e", "m", "b",
"u", "y", "v", "r", "g", "t", "c", "x", "/", "z",
}
local cmp = require'cmp'
cmp.setup({
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 }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'buffer' },
})
})