Dotfiles/.config/nvim/lua/completion.lua

47 lines
1.2 KiB
Lua

local cmp = require("cmp")
local lspkind = require('lspkind')
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
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(),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'nvim_lsp_document_symbol' },
{ name = 'nvim_lsp_signature_help' },
{ name = 'vsnip' },
{ name = 'path' },
{ name = 'treesitter' },
{ name = 'buffer' },
{ name = 'tmux' },
{ name = 'kitty' },
{ name = 'latex_symbols' },
{ name = 'emoji' },
{ name = 'html-css' },
}),
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
menu = ({
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
luasnip = "[LuaSnip]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
})
}),
}
})