Complete the completion setup

This commit is contained in:
flyingscorpio@clevo 2022-08-13 12:54:02 +02:00
parent c9bfe21723
commit 03dc05a28c
2 changed files with 31 additions and 27 deletions

View file

@ -2,11 +2,11 @@
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
local cmp = require'cmp'
if cmp then
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
require('luasnip').lsp_expand(args.body)
end,
},
window = {
@ -23,9 +23,12 @@ cmp.setup({
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lua' },
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'luasnip' },
}, {
{ name = 'buffer' },
}),
experimental = { ghost_text = true }
})
})
end

View file

@ -22,9 +22,10 @@ return require('packer').startup(function(use)
-- Completion
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-nvim-lua'
use 'hrsh7th/cmp-nvim-lsp'
-- LuaSnip
use 'L3MON4D3/LuaSnip'