mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-11-15 05:41:13 +00:00
103 lines
2.0 KiB
Lua
103 lines
2.0 KiB
Lua
local cmp = require("cmp")
|
|
|
|
local kind_icons = {
|
|
Array = " ",
|
|
Boolean = " ",
|
|
Class = " ",
|
|
Codeium = " ",
|
|
Color = " ",
|
|
Constant = " ",
|
|
Constructor = " ",
|
|
Copilot = " ",
|
|
Enum = " ",
|
|
EnumMember = " ",
|
|
Event = " ",
|
|
Field = " ",
|
|
File = " ",
|
|
Folder = " ",
|
|
Function = " ",
|
|
Interface = " ",
|
|
Key = " ",
|
|
Keyword = " ",
|
|
Method = " ",
|
|
Module = " ",
|
|
Namespace = " ",
|
|
Null = " ",
|
|
Number = " ",
|
|
Object = " ",
|
|
Operator = " ",
|
|
Package = " ",
|
|
Property = " ",
|
|
Reference = " ",
|
|
String = " ",
|
|
Struct = " ",
|
|
Text = " ",
|
|
TypeParameter = " ",
|
|
Unit = " ",
|
|
Value = " ",
|
|
Variable = " ",
|
|
}
|
|
|
|
cmp.setup({
|
|
mapping = {
|
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
|
["<C-k>"] = cmp.mapping.scroll_docs(-1),
|
|
["<C-j>"] = cmp.mapping.scroll_docs(1),
|
|
["<C-Space>"] = cmp.mapping.complete(),
|
|
["<C-q>"] = cmp.mapping.close(),
|
|
["<CR>"] = cmp.mapping.confirm({
|
|
behavior = cmp.ConfirmBehavior.Insert,
|
|
select = true,
|
|
}),
|
|
|
|
["<Tab>"] = cmp.mapping(function(fallback)
|
|
if cmp.visible() then
|
|
cmp.select_next_item()
|
|
else
|
|
fallback()
|
|
end
|
|
end, { "i", "s" }),
|
|
|
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
if cmp.visible() then
|
|
cmp.select_prev_item()
|
|
else
|
|
fallback()
|
|
end
|
|
end, { "i", "s" }),
|
|
},
|
|
|
|
formatting = {
|
|
fields = { "kind", "abbr", "menu" },
|
|
format = function(entry, vim_item)
|
|
vim_item.kind = kind_icons[vim_item.kind]
|
|
vim_item.menu = ({
|
|
nvim_lsp = "[lsp]",
|
|
buffer = "[local]",
|
|
copilot = "[AI]",
|
|
path = "",
|
|
emoji = "",
|
|
})[entry.source.name]
|
|
return vim_item
|
|
end,
|
|
},
|
|
sources = {
|
|
{ name = "nvim_lsp" },
|
|
{ name = "buffer" },
|
|
{ name = "path" },
|
|
{ name = "copilot" },
|
|
},
|
|
confirm_opts = {
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
select = false,
|
|
},
|
|
window = {
|
|
completion = cmp.config.window.bordered(),
|
|
documentation = cmp.config.window.bordered(),
|
|
},
|
|
experimental = {
|
|
ghost_text = { enabled = true },
|
|
},
|
|
})
|