Compare commits

...

2 Commits

Author SHA1 Message Date
2ed3dc3085
feat(nvim): integrate custom kind highlights into blink.cmp
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 33s
2024-12-26 16:14:53 -06:00
67a833913d
refactor(nvim): remove unnecessary rustaceanvim custom config 2024-12-26 16:14:16 -06:00
3 changed files with 41 additions and 44 deletions

View File

@ -7,11 +7,10 @@ return {
library = {
{ path = "luassert-types/library", words = { "assert" } },
{ 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 = {
{ "Bilal2453/luvit-meta", lazy = true },
{ "LuaCATS/luassert", lazy = true },
{ "LuaCATS/busted", lazy = true },
},
@ -36,9 +35,21 @@ return {
},
"amarakon/nvim-cmp-lua-latex-symbols",
"mikavilpas/blink-ripgrep.nvim",
"moyiz/blink-emoji.nvim",
},
build = "nix run .#build-plugin",
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
require("blink.cmp").setup({
-- 'default' for mappings similar to built-in completion
@ -107,14 +118,21 @@ return {
---@diagnostic disable-next-line: missing-fields
sources = {
default = {
"lazydev",
"lsp",
"path",
"snippets",
"buffer",
"ripgrep",
"emoji",
"dadbod",
},
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
score_offset = 100,
},
ripgrep = {
module = "blink-ripgrep",
score_offset = -3,
@ -139,6 +157,10 @@ return {
cache = true,
},
},
emoji = {
module = "blink-emoji",
name = "Emoji",
},
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
},
},
@ -164,8 +186,20 @@ return {
components = {
kind_icon = {
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
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,
},
},
},

View File

@ -137,23 +137,23 @@ return {
{ "BlinkCmpKindInterface", { fg = colors.fujiWhite, bg = colors.waveRed, blend = 0 } },
{ "BlinkCmpKindColor", { 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 } },
{ "CmpCustomSelectionDadbodCompletion", { fg = colors.fujiWhite, bg = colors.oniViolet, blend = 0 } },
{ "CmpCustomSelectionGit", { fg = colors.fujiWhite, bg = colors.roninYellow, blend = 0 } },
{ "CmpCustomSelectionBuffer", { fg = colors.fujiWhite, bg = colors.springBlue, blend = 0 } },
{ "CmpCustomSelectionPath", { fg = colors.fujiWhite, bg = colors.autumnYellow, blend = 0 } },
{ "CmpCustomSelectionCalculator", { fg = colors.fujiWhite, bg = colors.waveBlue2, 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 } },
{ "CmpCustomSelectionCrates", { fg = colors.fujiWhite, bg = colors.roninYellow, blend = 0 } },
{ "CmpCustomSelectionDocker", { fg = colors.fujiWhite, bg = colors.springBlue, 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 } },
{ "CmpCustomSelectionCommit", { 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
{ "TelescopeNormal", { bg = colors.sumiInk2 } },

View File

@ -94,42 +94,6 @@ return {
{
"mrcjkb/rustaceanvim",
lazy = false,
init = function()
vim.g.rustaceanvim = {
dap = {
adapter = {
type = "server",
port = "${port}",
executable = {
command = "codelldb",
args = { "--port", "${port}" },
},
},
},
server = {
default_settings = {
["rust-analyzer"] = {
cargo = {
targetDir = "target/rust-analyzer/",
},
checkOnSave = true,
rustfmt = {
rangeFormatting = {
enable = true,
},
},
},
},
},
tools = {
enable_clippy = true,
executor = require("rustaceanvim.executors").termopen,
hover_actions = {
replace_builtin_hover = false,
},
},
}
end,
config = false,
},
{
@ -274,8 +238,7 @@ return {
},
event = { "BufReadPre", "BufNewFile" },
config = function()
local lsp_capabilities =
require("blink.cmp").get_lsp_capabilities()
local lsp_capabilities = require("blink.cmp").get_lsp_capabilities()
local db_timer = vim.uv.new_timer()
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)