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

47 lines
1.2 KiB
Lua
Raw Permalink Normal View History

2023-11-17 10:08:13 +00:00
local cmp = require("cmp")
2023-11-20 14:44:31 +00:00
local lspkind = require('lspkind')
2023-11-17 10:08:13 +00:00
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' },
2023-11-22 09:39:58 +00:00
{ name = 'nvim_lsp_document_symbol' },
{ name = 'nvim_lsp_signature_help' },
2023-11-17 10:08:13 +00:00
{ name = 'vsnip' },
{ name = 'path' },
{ name = 'treesitter' },
2023-11-22 09:39:58 +00:00
{ name = 'buffer' },
{ name = 'tmux' },
{ name = 'kitty' },
{ name = 'latex_symbols' },
{ name = 'emoji' },
{ name = 'html-css' },
2023-11-20 14:44:31 +00:00
}),
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
menu = ({
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
luasnip = "[LuaSnip]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
})
}),
}
2023-11-17 10:08:13 +00:00
})