102 lines
2.0 KiB
Lua
Raw Normal View History

2023-08-22 14:51:35 +00:00
local icons = {
Namespace = "󰌗",
Text = "󰉿",
Method = "󰆧",
Function = "󰆧",
Constructor = "",
Field = "󰜢",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈚",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "󰙅",
Event = "",
Operator = "󰆕",
TypeParameter = "󰊄",
Table = "",
Object = "󰅩",
Tag = "",
Array = "[]",
Boolean = "",
Number = "",
Null = "󰟢",
String = "󰉿",
Calendar = "",
Watch = "󰥔",
Package = "",
Copilot = "",
Codeium = "",
TabNine = "",
}
2023-08-20 22:09:00 +00:00
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
2024-03-04 23:40:49 +00:00
-- "hrsh7th/cmp-nvim-lsp",
2023-10-20 13:55:21 +00:00
-- "hrsh7th/cmp-buffer",
-- "hrsh7th/cmp-path",
-- "L3MON4D3/LuaSnip",
2023-08-20 22:09:00 +00:00
},
2024-03-04 23:40:49 +00:00
opts = {
completion = {
autocomplete = true,
completeopt = "menu,menuone,noinsert",
},
formatting = {
fields = { "abbr", "kind", "menu" },
format = function(_, item)
local icon = icons[item.kind] or ""
item.kind = string.format(" %s %s", icon, item.kind)
return item
end,
},
-- snippet = {
-- expand = function(args)
-- require("luasnip").lsp_expand(args.body)
-- end,
-- },
-- preselect = cmp.PreselectMode.None,
sources = {
-- { name = "nvim_lsp" },
-- { name = "luasnip" },
{ name = "buffer" },
-- { name = "path" },
},
window = {
2023-08-22 14:51:35 +00:00
completion = {
2024-03-04 23:40:49 +00:00
border = "rounded",
scrollbar = false,
2023-08-22 14:51:35 +00:00
},
2024-03-04 23:40:49 +00:00
documentation = {
border = "rounded",
}
},
},
config = function(_, opts)
local cmp = require("cmp")
opts.mapping = {
["<C-space>"] = cmp.mapping.complete(),
["<C-up>"] = cmp.mapping.select_prev_item(),
["<C-down>"] = cmp.mapping.select_next_item(),
["<C-x>"] = cmp.mapping.abort(),
["<cr>"] = cmp.mapping.confirm({ select = true }),
2023-08-22 14:51:35 +00:00
}
cmp.setup(opts)
2023-08-20 22:09:00 +00:00
end,
}