lspkind icons

This commit is contained in:
Oliver Hartmann 2025-03-02 22:34:54 +01:00
parent cc2d3b770a
commit b8db9122eb

View File

@ -14,6 +14,7 @@ return {
}
},
'dmitmel/cmp-cmdline-history',
'onsails/lspkind.nvim',
'folke/lazydev.nvim',
'L3MON4D3/LuaSnip',
{
@ -50,39 +51,6 @@ return {
-- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = 'mono',
kind_icons = {
Copilot = '',
Text = '󰉿',
Method = '󰊕',
Function = '󰊕',
Constructor = '󰒓',
Field = '󰜢',
Variable = '󰆦',
Property = '󰖷',
Class = '󱡠',
Interface = '󱡠',
Struct = '󱡠',
Module = '󰅩',
Unit = '󰪚',
Value = '󰦨',
Enum = '󰦨',
EnumMember = '󰦨',
Keyword = '󰻾',
Constant = '󰏿',
Snippet = '󱄽',
Color = '󰏘',
File = '󰈔',
Reference = '󰬲',
Folder = '󰉋',
Event = '󱐋',
Operator = '󰪚',
TypeParameter = '󰬛',
},
},
-- default list of enabled providers defined so that you can extend it
@ -169,6 +137,41 @@ return {
padding = 1,
gap = 1,
-- treesitter = { 'lsp' },
components = {
kind_icon = {
ellipsis = false,
text = function(ctx)
local lspkind = require('lspkind')
local icon = ctx.kind_icon
if vim.tbl_contains({ 'Path' }, ctx.source_name) then
local dev_icon, _ = require('nvim-web-devicons').get_icon(ctx.label)
if dev_icon then
icon = dev_icon
end
else
icon = lspkind.symbolic(ctx.kind, {
mode = 'symbol',
})
end
return icon .. ctx.icon_gap
end,
-- Optionally, use the highlight groups from nvim-web-devicons
-- You can also add the same function for `kind.highlight` if you want to
-- keep the highlight groups in sync with the icons.
highlight = function(ctx)
local hl = ctx.kind_hl
if vim.tbl_contains({ 'Path' }, ctx.source_name) then
local dev_icon, dev_hl = require('nvim-web-devicons').get_icon(ctx.label)
if dev_icon then
hl = dev_hl
end
end
return hl
end,
}
}
},
},
documentation = {