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

View File

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