Archived
0
0
Fork 0
This repository has been archived on 2024-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
neovim-config/lua/plugins/configs/cmp.lua
Daryl Ronningen 69181599a5 rewrite config from scratch (#1)
Makes all the plugins lazyload, remove plugins with duplicate uses and just general nit picks and improvements

Reviewed-on: Relms/neovim-config#1
2022-09-02 17:42:32 +00:00

55 lines
1.3 KiB
Lua

local cmp = require("cmp")
local lspkind = require("lspkind")
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
completion = { completeopt = "menu,menuone,noinsert", keyword_length = 1 },
sources = {
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
{ name = "vsnip" },
{ name = "buffer" },
{ name = "path" },
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
window = {
documentation = {
border = { "", "", "", "", "", "", "", "" },
},
},
experimental = {
ghost_text = true,
native_menu = false,
},
formatting = {
fields = { "abbr", "kind", "menu" },
format = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = 50,
before = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[LSP]",
nvim_lua = "[NVIM_LUA]",
vsnip = "[SNIPPET]",
buffer = "[BUFFER]",
path = "[PATH]",
})[entry.source.name]
return vim_item
end,
}),
},
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 }),
}),
})