dotfiles/symlinks/config/nvim/lua/lsp/completion.lua

30 lines
878 B
Lua
Raw Normal View History

2021-02-23 11:27:32 +00:00
-------------------------------------------------------------------------------
-- - LSP completion config -
-------------------------------------------------------------------------------
-- Set completeopt to have a better completion experience
2021-10-08 14:28:07 +00:00
vim.o.completeopt = "menu,menuone,noselect"
2021-03-23 10:54:28 +00:00
local cmp = require "cmp"
2021-10-08 14:28:07 +00:00
cmp.setup {
snippet = {
expand = function(args)
vim.fn["UltiSnips#Anon"](args.body)
end
},
mapping = {
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<C-y>"] = cmp.mapping.confirm({select = true})
},
sources = {
{name = "nvim_lsp"},
{name = "nvim_lua"},
{name = "path"},
{name = "ultisnips"},
{name = "buffer"}
}
2021-03-23 10:54:28 +00:00
}