chore(nvim): add nvim-cmp plugin

This commit is contained in:
Stefan Imhoff
2022-11-21 21:08:54 +01:00
parent 99efeb11ec
commit e1c7c4b02f
2 changed files with 4 additions and 36 deletions

View File

@@ -43,6 +43,7 @@ local kind_icons = {
Event = "", Event = "",
Operator = "", Operator = "",
TypeParameter = "", TypeParameter = "",
Octoface = "",
} }
-- find more here: https://www.nerdfonts.com/cheat-sheet -- find more here: https://www.nerdfonts.com/cheat-sheet
@@ -98,12 +99,8 @@ cmp.setup({
-- Kind icons -- Kind icons
vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
if entry.source.name == "copilot" then
vim_item.kind = icons.git.Octoface
vim_item.kind_hl_group = "CmpItemKindCopilot"
end
-- vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind) -- This concatenates the icons with the name of the item kind
vim_item.menu = ({ vim_item.menu = ({
copilot = "[C]",
nvim_lsp = "[LSP]", nvim_lsp = "[LSP]",
luasnip = "[Snippet]", luasnip = "[Snippet]",
buffer = "[Buffer]", buffer = "[Buffer]",
@@ -118,37 +115,7 @@ cmp.setup({
end, end,
}, },
sources = { sources = {
{ { name = "copilot" },
name = "copilot",
-- keyword_length = 0,
max_item_count = 3,
trigger_characters = {
{
".",
":",
"(",
"'",
'"',
"[",
",",
"#",
"*",
"@",
"|",
"=",
"-",
"{",
"/",
"\\",
"+",
"?",
" ",
-- "\t",
-- "\n",
},
},
group_index = 2,
},
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" }, { name = "nvim_lsp_signature_help" },
{ name = "luasnip" }, { name = "luasnip" },

View File

@@ -59,6 +59,7 @@ return packer.startup(function(use)
use("hrsh7th/cmp-path") -- Path completions use("hrsh7th/cmp-path") -- Path completions
use("hrsh7th/cmp-cmdline") -- Cmdline completions use("hrsh7th/cmp-cmdline") -- Cmdline completions
use("hrsh7th/cmp-nvim-lua") -- Lua API completions use("hrsh7th/cmp-nvim-lua") -- Lua API completions
use("hrsh7th/cmp-copilot") -- GitHub Copilot completions
use("saadparwaiz1/cmp_luasnip") -- Snippet completions use("saadparwaiz1/cmp_luasnip") -- Snippet completions
use("uga-rosa/cmp-dictionary") -- Dictionary completions use("uga-rosa/cmp-dictionary") -- Dictionary completions
use("f3fora/cmp-spell") -- Spell completions use("f3fora/cmp-spell") -- Spell completions