feat(nvim): add cmp custom selection coloring

This commit is contained in:
Price Hiller 2022-09-08 00:39:57 -05:00
parent 9f8298fa0a
commit a7652bb193
2 changed files with 57 additions and 44 deletions

View File

@ -13,18 +13,17 @@ cmp.setup({
fields = { cmp.ItemField.Kind, cmp.ItemField.Abbr, cmp.ItemField.Menu }, fields = { cmp.ItemField.Kind, cmp.ItemField.Abbr, cmp.ItemField.Menu },
format = function(entry, vim_item) format = function(entry, vim_item)
local selections = { local selections = {
fuzzy_buffer = { symbol = "", name = "Buffer" }, fuzzy_buffer = { symbol = "", name = "Buffer", hl_group = "Buffer" },
luasnip = { symbol = "", name = "Snippet" }, path = { symbol = "", name = "Path", hl_group = "Path" },
path = { symbol = "", name = "Path" }, calc = { symbol = "", name = "Calculator", hl_group = "Calculator" },
calc = { symbol = "", name = "Calculator" }, neorg = { symbol = "", name = "Neorg", hl_group = "Neorg" },
neorg = { symbol = "", name = "Neorg" }, emoji = { symbol = "", name = "Emoji", hl_group = "Emoji" },
emoji = { symbol = "", name = "Emoji" }, zsh = { symbol = "", name = "Zsh", hl_group = "Zsh" },
zsh = { symbol = "", name = "Zsh" }, crates = { symbol = "", name = "Crates", hl_group = "Crates" },
crates = { symbol = "", name = "Crates" }, cmdline_history = { symbol = "", name = "Cmd History", hl_group = "CmdHistory" },
cmdline_history = { symbol = "", name = "Cmd History" }, rg = { symbol = "", name = "Ripgrep", hl_group = "Ripgrep" },
rg = { symbol = "", name = "Ripgrep" }, npm = { symbol = "", name = "Npm,", hl_group = "Npm," },
npm = { symbol = "", name = "Npm," }, conventionalcommits = { symbol = "", name = "Commit", hl_group = "Commit" },
conventionalcommits = { symbol = "", name = "Commit" },
} }
local selection = selections[entry.source.name] local selection = selections[entry.source.name]
@ -52,6 +51,7 @@ cmp.setup({
end end
vim_item.kind = " " .. selection.symbol vim_item.kind = " " .. selection.symbol
vim_item.menu = selection.symbol .. selection.name vim_item.menu = selection.symbol .. selection.name
vim_item.kind_hl_group = "CmpCustomSelection" .. selection.hl_group
vim_item.abbr = word vim_item.abbr = word
return vim_item return vim_item
end end

View File

@ -82,45 +82,58 @@ return packer.startup({
NeogitDiffDeleteHighlight = { fg = colors.git.removed, bg = colors.diff.delete }, NeogitDiffDeleteHighlight = { fg = colors.git.removed, bg = colors.diff.delete },
NeogitDiffAddHighlight = { fg = colors.git.added, bg = colors.diff.add }, NeogitDiffAddHighlight = { fg = colors.git.added, bg = colors.diff.add },
NeogitCommitViewHeader = { fg = colors.git.changed, bg = colors.diff.text }, NeogitCommitViewHeader = { fg = colors.git.changed, bg = colors.diff.text },
menuSel = { bg = "#16161D", fg = "NONE" }, menuSel = { bg = colors.sumiInk0, fg = "NONE" },
Pmenu = { fg = "#DCD7BA", bg = "#22252A" }, Pmenu = { fg = colors.fujiWhite, bg = colors.sumiInk2 },
CmpItemAbbrDeprecated = { fg = "#7E8294", bg = "NONE" }, CmpItemAbbrDeprecated = { fg = colors.fujiGray, bg = "NONE" },
CmpItemAbbrMatch = { fg = "#7E9CD8", bg = "NONE" }, CmpItemAbbrMatch = { fg = colors.crystalBlue, bg = "NONE" },
CmpItemAbbrMatchFuzzy = { fg = "#7E9CD8", bg = "NONE" }, CmpItemAbbrMatchFuzzy = { fg = colors.crystalBlue, bg = "NONE" },
CmpItemMenu = { fg = "#FF9E3B", bg = "NONE" }, CmpItemMenu = { fg = colors.roninYellow, bg = "NONE" },
CmpItemKindField = { fg = "#DCD7BA", bg = "#D27E99" }, CmpItemKindField = { fg = colors.fujiWhite, bg = colors.sakuraPink },
CmpItemKindProperty = { fg = "#DCD7BA", bg = "#D27E99" }, CmpItemKindProperty = { fg = colors.fujiWhite, bg = colors.sakuraPink },
CmpItemKindEvent = { fg = "#DCD7BA", bg = "#D27E99" }, CmpItemKindEvent = { fg = colors.fujiWhite, bg = colors.sakuraPink },
CmpItemKindText = { fg = "#DCD7BA", bg = "#76946A" }, CmpItemKindText = { fg = colors.fujiWhite, bg = colors.dragonBlue },
CmpItemKindEnum = { fg = "#DCD7BA", bg = "#76946A" }, CmpItemKindEnum = { fg = colors.fujiWhite, bg = colors.autumnGreen },
CmpItemKindKeyword = { fg = "#DCD7BA", bg = "#76946A" }, CmpItemKindKeyword = { fg = colors.fujiWhite, bg = colors.autumnGreen },
CmpItemKindConstant = { fg = "#DCD7BA", bg = "#C0A36E" }, CmpItemKindConstant = { fg = colors.fujiWhite, bg = colors.boatYellow2 },
CmpItemKindConstructor = { fg = "#DCD7BA", bg = "#C0A36E" }, CmpItemKindConstructor = { fg = colors.fujiWhite, bg = colors.boatYellow2 },
CmpItemKindReference = { fg = "#DCD7BA", bg = "#C0A36E" }, CmpItemKindReference = { fg = colors.fujiWhite, bg = colors.boatYellow2 },
CmpItemKindFunction = { fg = "#DCD7BA", bg = "#957FB8" }, CmpItemKindFunction = { fg = colors.fujiWhite, bg = colors.oniViolet },
CmpItemKindStruct = { fg = "#DCD7BA", bg = "#957FB8" }, CmpItemKindStruct = { fg = colors.fujiWhite, bg = colors.oniViolet },
CmpItemKindClass = { fg = "#DCD7BA", bg = "#957FB8" }, CmpItemKindClass = { fg = colors.fujiWhite, bg = colors.oniViolet },
CmpItemKindModule = { fg = "#DCD7BA", bg = "#957FB8" }, CmpItemKindModule = { fg = colors.fujiWhite, bg = colors.oniViolet },
CmpItemKindOperator = { fg = "#DCD7BA", bg = "#957FB8" }, CmpItemKindOperator = { fg = colors.fujiWhite, bg = colors.oniViolet },
CmpItemKindVariable = { fg = "#DCD7BA", bg = "#54546D" }, CmpItemKindVariable = { fg = colors.fujiWhite, bg = colors.sumiInk4 },
CmpItemKindFile = { fg = "#DCD7BA", bg = "#54546D" }, CmpItemKindFile = { fg = colors.fujiWhite, bg = colors.autumnYellow },
CmpItemKindUnit = { fg = "#DCD7BA", bg = "#DCA561" }, CmpItemKindUnit = { fg = colors.fujiWhite, bg = colors.autumnYellow },
CmpItemKindSnippet = { fg = "#DCD7BA", bg = "#DCA561" }, CmpItemKindSnippet = { fg = colors.fujiWhite, bg = colors.autumnYellow },
CmpItemKindFolder = { fg = "#DCD7BA", bg = "#DCA561" }, CmpItemKindFolder = { fg = colors.fujiWhite, bg = colors.autumnYellow },
CmpItemKindMethod = { fg = "#DCD7BA", bg = "#7E9CD8" }, CmpItemKindMethod = { fg = colors.fujiWhite, bg = colors.dragonBlue },
CmpItemKindValue = { fg = "#DCD7BA", bg = "#7E9CD8" }, CmpItemKindValue = { fg = colors.fujiWhite, bg = colors.dragonBlue },
CmpItemKindEnumMember = { fg = "#DCD7BA", bg = "#7E9CD8" }, CmpItemKindEnumMember = { fg = colors.fujiWhite, bg = colors.dragonBlue },
CmpItemKindInterface = { fg = "#DCD7BA", bg = "#7AA89F" }, CmpItemKindInterface = { fg = colors.fujiWhite, bg = colors.waveAqua2 },
CmpItemKindColor = { fg = "#DCD7BA", bg = "#7AA89F" }, CmpItemKindColor = { fg = colors.fujiWhite, bg = colors.waveAqua2 },
CmpItemKindTypeParameter = { fg = "#DCD7BA", bg = "#7AA89F" }, CmpItemKindTypeParameter = { fg = colors.fujiWhite, bg = colors.waveAqua2 },
WinSeparator = { fg = "#54546D", bg = "NONE" },
CmpCustomSelectionBuffer = { fg = colors.fujiWhite, bg = colors.dragonBlue },
CmpCustomSelectionPath = { fg = colors.fujiWhite, bg = colors.autumnYellow },
CmpCustomSelectionCalculator = { fg = colors.fujiWhite, bg = colors.waveBlue2 },
CmpCustomSelectionNeorg = { fg = colors.fujiWhite, bg = colors.waveAqua1 },
CmpCustomSelectionEmoji = { fg = colors.fujiWhite, bg = colors.dragonBlue },
CmpCustomSelectionZsh = { fg = colors.fujiWhite, bg = colors.waveBlue2 },
CmpCustomSelectionCrates = { fg = colors.fujiWhite, bg = colors.roninYellow },
CmpCustomSelectionCmdHistory = { fg = colors.fujiWhite, bg = colors.waveBlue2 },
CmpCustomSelectionRipgrep = { fg = colors.fujiWhite, bg = colors.dragonBlue },
CmpCustomSelectionNpm = { fg = colors.fujiWhite, bg = colors.peachRed },
CmpCustomSelectionCommit = { fg = colors.fujiWhite, bg = colors.peachRed },
WinSeparator = { fg = colors.sumiInk4, bg = "NONE" },
}, },
}) })
end, end,