feat(nvim): integrate custom kind highlights into blink.cmp
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 33s
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 33s
This commit is contained in:
parent
67a833913d
commit
2ed3dc3085
@ -7,11 +7,10 @@ return {
|
|||||||
library = {
|
library = {
|
||||||
{ path = "luassert-types/library", words = { "assert" } },
|
{ path = "luassert-types/library", words = { "assert" } },
|
||||||
{ path = "busted-types/library", words = { "describe" } },
|
{ path = "busted-types/library", words = { "describe" } },
|
||||||
{ path = "luvit-meta/library", words = { "vim%.uv", "vim%.loop" } },
|
{ path = "${3rd}/luv/library", words = { "vim%.uv", "vim%.loop" } },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "Bilal2453/luvit-meta", lazy = true },
|
|
||||||
{ "LuaCATS/luassert", lazy = true },
|
{ "LuaCATS/luassert", lazy = true },
|
||||||
{ "LuaCATS/busted", lazy = true },
|
{ "LuaCATS/busted", lazy = true },
|
||||||
},
|
},
|
||||||
@ -36,9 +35,21 @@ return {
|
|||||||
},
|
},
|
||||||
"amarakon/nvim-cmp-lua-latex-symbols",
|
"amarakon/nvim-cmp-lua-latex-symbols",
|
||||||
"mikavilpas/blink-ripgrep.nvim",
|
"mikavilpas/blink-ripgrep.nvim",
|
||||||
|
"moyiz/blink-emoji.nvim",
|
||||||
},
|
},
|
||||||
build = "nix run .#build-plugin",
|
build = "nix run .#build-plugin",
|
||||||
config = function()
|
config = function()
|
||||||
|
---@class CustomKindMapItem
|
||||||
|
---@field icon string
|
||||||
|
---@field hlgroup string
|
||||||
|
|
||||||
|
---@type table<string, CustomKindMapItem>
|
||||||
|
local custom_kind_map = {
|
||||||
|
Dadbod = { icon = "", hlgroup = "Dadbod" },
|
||||||
|
Emoji = { icon = "", hlgroup = "Emoji" },
|
||||||
|
Ripgrep = { icon = "", hlgroup = "Ripgrep" },
|
||||||
|
["lua-latex-symbols"] = { icon = "", hlgroup = "LatexSymbol" },
|
||||||
|
}
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
require("blink.cmp").setup({
|
require("blink.cmp").setup({
|
||||||
-- 'default' for mappings similar to built-in completion
|
-- 'default' for mappings similar to built-in completion
|
||||||
@ -107,14 +118,21 @@ return {
|
|||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
sources = {
|
sources = {
|
||||||
default = {
|
default = {
|
||||||
|
"lazydev",
|
||||||
"lsp",
|
"lsp",
|
||||||
"path",
|
"path",
|
||||||
"snippets",
|
"snippets",
|
||||||
"buffer",
|
"buffer",
|
||||||
"ripgrep",
|
"ripgrep",
|
||||||
|
"emoji",
|
||||||
"dadbod",
|
"dadbod",
|
||||||
},
|
},
|
||||||
providers = {
|
providers = {
|
||||||
|
lazydev = {
|
||||||
|
name = "LazyDev",
|
||||||
|
module = "lazydev.integrations.blink",
|
||||||
|
score_offset = 100,
|
||||||
|
},
|
||||||
ripgrep = {
|
ripgrep = {
|
||||||
module = "blink-ripgrep",
|
module = "blink-ripgrep",
|
||||||
score_offset = -3,
|
score_offset = -3,
|
||||||
@ -139,6 +157,10 @@ return {
|
|||||||
cache = true,
|
cache = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
emoji = {
|
||||||
|
module = "blink-emoji",
|
||||||
|
name = "Emoji",
|
||||||
|
},
|
||||||
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
|
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -164,8 +186,20 @@ return {
|
|||||||
components = {
|
components = {
|
||||||
kind_icon = {
|
kind_icon = {
|
||||||
text = function(ctx)
|
text = function(ctx)
|
||||||
|
local cust_kind_item = custom_kind_map[ctx.source_name]
|
||||||
|
if cust_kind_item then
|
||||||
|
ctx.kind_icon = cust_kind_item.icon
|
||||||
|
end
|
||||||
return ctx.icon_gap .. ctx.kind_icon .. ctx.icon_gap
|
return ctx.icon_gap .. ctx.kind_icon .. ctx.icon_gap
|
||||||
end,
|
end,
|
||||||
|
highlight = function(ctx)
|
||||||
|
local cust_kind_item = custom_kind_map[ctx.source_name]
|
||||||
|
if cust_kind_item then
|
||||||
|
return "BlinkCmpKindCustom" .. cust_kind_item.hlgroup
|
||||||
|
end
|
||||||
|
return require("blink.cmp.completion.windows.render.tailwind").get_hl(ctx)
|
||||||
|
or ("BlinkCmpKind" .. ctx.kind)
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -137,23 +137,23 @@ return {
|
|||||||
{ "BlinkCmpKindInterface", { fg = colors.fujiWhite, bg = colors.waveRed, blend = 0 } },
|
{ "BlinkCmpKindInterface", { fg = colors.fujiWhite, bg = colors.waveRed, blend = 0 } },
|
||||||
{ "BlinkCmpKindColor", { fg = colors.fujiWhite, bg = colors.waveAqua2, blend = 0 } },
|
{ "BlinkCmpKindColor", { fg = colors.fujiWhite, bg = colors.waveAqua2, blend = 0 } },
|
||||||
{ "BlinkCmpKindTypeParameter", { fg = colors.fujiWhite, bg = colors.waveAqua2, blend = 0 } },
|
{ "BlinkCmpKindTypeParameter", { fg = colors.fujiWhite, bg = colors.waveAqua2, blend = 0 } },
|
||||||
|
{ "BlinkCmpKindCustomEmoji", { fg = colors.fujiWhite, bg = colors.boatYellow2, blend = 0 } },
|
||||||
|
{ "BlinkCmpKindCustomRipgrep", { fg = colors.fujiWhite, bg = colors.crystalBlue, blend = 0 } },
|
||||||
|
{ "BlinkCmpKindCustomDadbod", { fg = colors.fujiWhite, bg = colors.oniViolet, blend = 0 } },
|
||||||
|
{ "BlinkCmpKindCustomLatexSymbol", { fg = colors.fujiWhite, bg = colors.surimiOrange, blend = 0 } },
|
||||||
{ "CmpCustomSelectionColor", { bg = colors.sumiInk5, blend = 0 } },
|
{ "CmpCustomSelectionColor", { bg = colors.sumiInk5, blend = 0 } },
|
||||||
{ "CmpCustomSelectionDadbodCompletion", { fg = colors.fujiWhite, bg = colors.oniViolet, blend = 0 } },
|
|
||||||
{ "CmpCustomSelectionGit", { fg = colors.fujiWhite, bg = colors.roninYellow, blend = 0 } },
|
{ "CmpCustomSelectionGit", { fg = colors.fujiWhite, bg = colors.roninYellow, blend = 0 } },
|
||||||
{ "CmpCustomSelectionBuffer", { fg = colors.fujiWhite, bg = colors.springBlue, blend = 0 } },
|
{ "CmpCustomSelectionBuffer", { fg = colors.fujiWhite, bg = colors.springBlue, blend = 0 } },
|
||||||
{ "CmpCustomSelectionPath", { fg = colors.fujiWhite, bg = colors.autumnYellow, blend = 0 } },
|
{ "CmpCustomSelectionPath", { fg = colors.fujiWhite, bg = colors.autumnYellow, blend = 0 } },
|
||||||
{ "CmpCustomSelectionCalculator", { fg = colors.fujiWhite, bg = colors.waveBlue2, blend = 0 } },
|
{ "CmpCustomSelectionCalculator", { fg = colors.fujiWhite, bg = colors.waveBlue2, blend = 0 } },
|
||||||
{ "CmpCustomSelectionOrgmode", { fg = colors.fujiWhite, bg = colors.waveAqua1, blend = 0 } },
|
{ "CmpCustomSelectionOrgmode", { fg = colors.fujiWhite, bg = colors.waveAqua1, blend = 0 } },
|
||||||
{ "CmpCustomSelectionEmoji", { fg = colors.fujiWhite, bg = colors.carpYellow, blend = 0 } },
|
|
||||||
{ "CmpCustomSelectionZsh", { fg = colors.fujiWhite, bg = colors.springGreen, blend = 0 } },
|
{ "CmpCustomSelectionZsh", { fg = colors.fujiWhite, bg = colors.springGreen, blend = 0 } },
|
||||||
{ "CmpCustomSelectionCrates", { fg = colors.fujiWhite, bg = colors.roninYellow, blend = 0 } },
|
{ "CmpCustomSelectionCrates", { fg = colors.fujiWhite, bg = colors.roninYellow, blend = 0 } },
|
||||||
{ "CmpCustomSelectionDocker", { fg = colors.fujiWhite, bg = colors.springBlue, blend = 0 } },
|
{ "CmpCustomSelectionDocker", { fg = colors.fujiWhite, bg = colors.springBlue, blend = 0 } },
|
||||||
{ "CmpCustomSelectionCmdHistory", { fg = colors.fujiWhite, bg = colors.waveBlue2, blend = 0 } },
|
{ "CmpCustomSelectionCmdHistory", { fg = colors.fujiWhite, bg = colors.waveBlue2, blend = 0 } },
|
||||||
{ "CmpCustomSelectionRipgrep", { fg = colors.fujiWhite, bg = colors.crystalBlue, blend = 0 } },
|
|
||||||
{ "CmpCustomSelectionNpm", { fg = colors.fujiWhite, bg = colors.peachRed, blend = 0 } },
|
{ "CmpCustomSelectionNpm", { fg = colors.fujiWhite, bg = colors.peachRed, blend = 0 } },
|
||||||
{ "CmpCustomSelectionCommit", { fg = colors.fujiWhite, bg = colors.peachRed, blend = 0 } },
|
{ "CmpCustomSelectionCommit", { fg = colors.fujiWhite, bg = colors.peachRed, blend = 0 } },
|
||||||
{ "CmpCustomSelectionSnippet", { fg = colors.fujiWhite, bg = colors.peachRed, blend = 0 } },
|
{ "CmpCustomSelectionSnippet", { fg = colors.fujiWhite, bg = colors.peachRed, blend = 0 } },
|
||||||
{ "CmpCustomSelectionLuaLatexSymbol", { fg = colors.fujiWhite, bg = colors.surimiOrange, blend = 0 } },
|
|
||||||
|
|
||||||
-- Telescope
|
-- Telescope
|
||||||
{ "TelescopeNormal", { bg = colors.sumiInk2 } },
|
{ "TelescopeNormal", { bg = colors.sumiInk2 } },
|
||||||
|
Loading…
Reference in New Issue
Block a user