feat(completion): add kind icons to blink completion menu

This commit is contained in:
sankalp committed 2025-09-14 14:57:53 +05:45
1 parent aa7746cc51
commit 89a6ca8d08
2 files changed
+441 -412

No files matched your search

+84 -55
View File
@@ -1,58 +1,87 @@
return { return {
-- snippets -- snippets
{ {
"L3MON4D3/LuaSnip", 'L3MON4D3/LuaSnip',
version = "*", version = '*',
dependencies = { "rafamadriz/friendly-snippets" }, dependencies = { 'rafamadriz/friendly-snippets' },
config = function() config = function()
require("luasnip.loaders.from_vscode").lazy_load() require('luasnip.loaders.from_vscode').lazy_load()
end, end,
}, },
-- completion -- completion
{ {
"saghen/blink.cmp", 'saghen/blink.cmp',
version = "*", version = '*',
dependencies = { dependencies = {
"L3MON4D3/LuaSnip", 'L3MON4D3/LuaSnip',
}, },
config = function() config = function()
require("blink.cmp").setup({ require('blink.cmp').setup({
completion = { appearance = {
list = { kind_icons = {
selection = { Text = '',
preselect = false, Method = '',
auto_insert = true, Function = 'ƒ',
}, Constructor = '',
}, Field = '',
documentation = { Variable = '',
window = { border = "rounded" }, Property = '󰓹',
auto_show = true, Class = '',
auto_show_delay_ms = 50, Interface = '',
}, Struct = '',
menu = { Module = '󰩦',
border = "rounded", Unit = '',
}, Value = '',
}, Enum = '',
signature = { EnumMember = '',
window = { border = "rounded" }, Keyword = '',
}, Constant = 'П',
sources = { Snippet = '',
default = { "lsp", "path", "snippets", "buffer" }, Color = '',
providers = {}, File = '',
}, Reference = '',
snippets = { preset = "luasnip" }, Folder = '',
keymap = { Event = '',
preset = "none", Operator = '',
["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" }, TypeParameter = '',
["<Tab>"] = { "select_next", "snippet_forward", "fallback" }, },
["<CR>"] = { "accept", "fallback" }, },
["<C-space>"] = { "hide", "show" }, completion = {
["<C-y>"] = { "show", "show_documentation", "hide_documentation" }, list = {
["<C-u>"] = { "scroll_documentation_up", "fallback" }, selection = {
["<C-d>"] = { "scroll_documentation_down", "fallback" }, preselect = false,
}, auto_insert = true,
}) },
end, },
}, documentation = {
window = { border = 'rounded' },
auto_show = true,
auto_show_delay_ms = 50,
},
menu = {
border = 'rounded',
},
},
signature = {
window = { border = 'rounded' },
},
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
providers = {},
},
snippets = { preset = 'luasnip' },
keymap = {
preset = 'none',
['<S-Tab>'] = { 'select_prev', 'snippet_backward', 'fallback' },
['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' },
['<CR>'] = { 'accept', 'fallback' },
['<C-space>'] = { 'hide', 'show' },
['<C-y>'] = { 'show', 'show_documentation', 'hide_documentation' },
['<C-u>'] = { 'scroll_documentation_up', 'fallback' },
['<C-d>'] = { 'scroll_documentation_down', 'fallback' },
},
})
end,
},
} }
+357 -357
View File
@@ -1,362 +1,362 @@
return { return {
"folke/snacks.nvim", 'folke/snacks.nvim',
priority = 1000, priority = 1000,
lazy = false, lazy = false,
-- opts = { -- opts = {
-- bigfile = { enabled = true }, -- bigfile = { enabled = true },
-- dashboard = { enabled = true }, -- dashboard = { enabled = true },
-- explorer = { enabled = true }, -- explorer = { enabled = true },
-- indent = { enabled = true }, -- indent = { enabled = true },
-- input = { enabled = true }, -- input = { enabled = true },
-- notifier = { -- notifier = {
-- enabled = true, -- enabled = true,
-- timeout = 3000, -- timeout = 3000,
-- }, -- },
-- picker = { enabled = true }, -- picker = { enabled = true },
-- quickfile = { enabled = true }, -- quickfile = { enabled = true },
-- scope = { enabled = true }, -- scope = { enabled = true },
-- scroll = { enabled = true }, -- scroll = { enabled = true },
-- statuscolumn = { enabled = true }, -- statuscolumn = { enabled = true },
-- words = { enabled = true }, -- words = { enabled = true },
-- styles = { -- styles = {
-- notification = { -- notification = {
-- -- wo = { wrap = true } -- Wrap notifications -- -- wo = { wrap = true } -- Wrap notifications
-- }, -- },
-- }, -- },
-- }, -- },
config = function() config = function()
local function files_layout(preview_width, height, width) local function files_layout(preview_width, height, width)
preview_width = preview_width or 0.6 preview_width = preview_width or 0.6
height = height or 0.8 height = height or 0.8
width = width or 0.9 width = width or 0.9
return { return {
layout = { layout = {
box = "horizontal", box = 'horizontal',
width = width, width = width,
min_width = 120, min_width = 120,
height = height, height = height,
{ {
box = "vertical", box = 'vertical',
border = "rounded", border = 'rounded',
title = "{title} {live} {flags}", title = '{title} {live} {flags}',
{ win = "input", height = 1, border = "bottom" }, { win = 'input', height = 1, border = 'bottom' },
{ win = "list", border = "none" }, { win = 'list', border = 'none' },
}, },
{ win = "preview", title = "{preview}", border = "rounded", width = preview_width }, { win = 'preview', title = '{preview}', border = 'rounded', width = preview_width },
}, },
} }
end end
local function palette_layout(height, width) local function palette_layout(height, width)
height = height or 0.4 height = height or 0.4
width = width or 0.6 width = width or 0.6
return { return {
preview = false, preview = false,
layout = { layout = {
backdrop = false, backdrop = false,
row = 1, row = 1,
width = width, width = width,
min_width = 80, min_width = 80,
height = height, height = height,
border = "rounded", border = 'rounded',
box = "vertical", box = 'vertical',
{ {
win = "input", win = 'input',
height = 1, height = 1,
border = "rounded", border = 'rounded',
title = "{title} {live} {flags}", title = '{title} {live} {flags}',
title_pos = "center", title_pos = 'center',
}, },
{ win = "list", border = "hpad" }, { win = 'list', border = 'hpad' },
{ win = "preview", title = "{preview}", border = "rounded" }, { win = 'preview', title = '{preview}', border = 'rounded' },
}, },
} }
end end
local Snacks = require("snacks") local Snacks = require('snacks')
Snacks.setup({ Snacks.setup({
animate = { animate = {
enabled = true, enabled = true,
duration = 20, -- ms per step duration = 20, -- ms per step
easing = "linear", easing = 'linear',
fps = 60, fps = 60,
}, },
bigfile = { bigfile = {
enabled = true, enabled = true,
notify = true, notify = true,
size = 1000 * 1024, -- 1 MB instead of 100 KB size = 1000 * 1024, -- 1 MB instead of 100 KB
}, },
bufdelete = { enabled = true }, bufdelete = { enabled = true },
dashboard = { dashboard = {
enabled = true, enabled = true,
sections = { sections = {
{ section = "header" }, { section = 'header' },
{ {
icon = "", icon = '',
title = "Keymaps", title = 'Keymaps',
section = "keys", section = 'keys',
indent = 2, indent = 2,
padding = 1, padding = 1,
}, },
{ {
icon = "", icon = '',
title = "Recent Files", title = 'Recent Files',
section = "recent_files", section = 'recent_files',
indent = 2, indent = 2,
padding = 1, padding = 1,
}, },
{ {
icon = "", icon = '',
title = "Projects", title = 'Projects',
section = "projects", section = 'projects',
indent = 2, indent = 2,
padding = 1, padding = 1,
}, },
{ section = "startup" }, { section = 'startup' },
}, },
}, },
debug = { enabled = true }, debug = { enabled = true },
dim = { dim = {
enabled = true, enabled = true,
scope = { scope = {
min_size = 5, min_size = 5,
max_size = 20, max_size = 20,
siblings = true, siblings = true,
}, },
}, },
explorer = { enabled = false }, explorer = { enabled = false },
git = { enabled = true }, git = { enabled = true },
gitbrowse = { enabled = true }, gitbrowse = { enabled = true },
image = { enabled = true }, image = { enabled = true },
indent = { indent = {
enabled = true, enabled = true,
priority = 1, priority = 1,
char = "▍", char = '▍',
only_scope = false, only_scope = false,
only_current = false, only_current = false,
hl = { hl = {
"SnacksIndent1", 'SnacksIndent1',
"SnacksIndent2", 'SnacksIndent2',
"SnacksIndent3", 'SnacksIndent3',
"SnacksIndent4", 'SnacksIndent4',
"SnacksIndent5", 'SnacksIndent5',
"SnacksIndent6", 'SnacksIndent6',
"SnacksIndent7", 'SnacksIndent7',
"SnacksIndent8", 'SnacksIndent8',
}, },
}, },
input = { input = {
enabled = true, enabled = true,
icon = "", icon = '',
icon_hl = "SnacksInputIcon", icon_hl = 'SnacksInputIcon',
icon_pos = "left", icon_pos = 'left',
prompt_pos = "title", prompt_pos = 'title',
win = { style = "input" }, win = { style = 'input' },
expand = true, expand = true,
}, },
layout = { enabled = true }, layout = { enabled = true },
lazygit = { enabled = true }, lazygit = { enabled = true },
notifier = { notifier = {
enabled = true, enabled = true,
timeout = 2000, timeout = 2000,
width = { min = 40, max = 0.4 }, width = { min = 40, max = 0.4 },
height = { min = 1, max = 0.6 }, height = { min = 1, max = 0.6 },
margin = { top = 0, right = 1, bottom = 0 }, margin = { top = 0, right = 1, bottom = 0 },
padding = true, padding = true,
sort = { "level", "added" }, sort = { 'level', 'added' },
level = vim.log.levels.TRACE, level = vim.log.levels.TRACE,
icons = { icons = {
debug = "", debug = '',
error = "", error = '',
info = "", info = '',
trace = "", trace = '',
warn = "", warn = '',
}, },
style = "compact", style = 'compact',
top_down = true, top_down = true,
date_format = "%R", date_format = '%R',
more_format = " ↓ %d lines ", more_format = ' ↓ %d lines ',
refresh = 50, refresh = 50,
}, },
notify = { enabled = true }, notify = { enabled = true },
picker = { picker = {
enabled = true, enabled = true,
icon = "", icon = '',
icon_hl = "SnacksPickerIcon", icon_hl = 'SnacksPickerIcon',
icon_pos = "left", icon_pos = 'left',
prompt_pos = "title", prompt_pos = 'title',
win = { style = "picker" }, win = { style = 'picker' },
expand = true, expand = true,
matchers = { matchers = {
frecency = true, frecency = true,
cwd_bonus = false, cwd_bonus = false,
}, },
sources = { sources = {
-- layout options: dropdown, horizontal, vertical, vscode, ivy, ivy_split, telescope, top, left, right, bottom, sidebar -- layout options: dropdown, horizontal, vertical, vscode, ivy, ivy_split, telescope, top, left, right, bottom, sidebar
buffers = { layout = files_layout() }, buffers = { layout = files_layout() },
commands = { layout = palette_layout() }, commands = { layout = palette_layout() },
command_history = { layout = palette_layout() }, command_history = { layout = palette_layout() },
files = { files = {
hidden = true, hidden = true,
layout = files_layout(), layout = files_layout(),
}, },
icons = { icons = {
icon_sources = { "nerd_fonts", "emoji" }, icon_sources = { 'nerd_fonts', 'emoji' },
layout = palette_layout(), layout = palette_layout(),
}, },
git_files = { layout = files_layout() }, git_files = { layout = files_layout() },
git_branches = { layout = { preset = "vertical" } }, git_branches = { layout = { preset = 'vertical' } },
git_status = { layout = files_layout() }, git_status = { layout = files_layout() },
help = { layout = { preset = "ivy_split" } }, help = { layout = { preset = 'ivy_split' } },
man = { layout = { preset = "ivy_split" } }, man = { layout = { preset = 'ivy_split' } },
notifications = { layout = palette_layout() }, notifications = { layout = palette_layout() },
projects = { layout = files_layout(0.8) }, projects = { layout = files_layout(0.8) },
recent = { layout = files_layout() }, recent = { layout = files_layout() },
search_history = { layout = palette_layout() }, search_history = { layout = palette_layout() },
smart = { layout = files_layout() }, smart = { layout = files_layout() },
undo = { layout = { preset = "ivy" } }, undo = { layout = { preset = 'ivy' } },
zoxide = { layout = files_layout(0.7) }, zoxide = { layout = files_layout(0.7) },
}, },
}, },
profiler = { enabled = true }, profiler = { enabled = true },
quickfile = { enabled = true }, quickfile = { enabled = true },
rename = { enabled = true }, rename = { enabled = true },
scope = { scope = {
enabled = true, enabled = true,
keys = { keys = {
textobject = { textobject = {
ii = { ii = {
min_size = 2, -- minimum size of the scope min_size = 2, -- minimum size of the scope
edge = false, -- inner scope edge = false, -- inner scope
cursor = false, cursor = false,
treesitter = { blocks = { enabled = false } }, treesitter = { blocks = { enabled = false } },
desc = "inner scope", desc = 'inner scope',
}, },
ai = { ai = {
cursor = false, cursor = false,
min_size = 2, -- minimum size of the scope min_size = 2, -- minimum size of the scope
treesitter = { blocks = { enabled = false } }, treesitter = { blocks = { enabled = false } },
desc = "full scope", desc = 'full scope',
}, },
}, },
jump = { jump = {
["[a"] = { ['[a'] = {
min_size = 1, -- allow single line scopes min_size = 1, -- allow single line scopes
bottom = false, bottom = false,
cursor = false, cursor = false,
edge = true, edge = true,
treesitter = { blocks = { enabled = false } }, treesitter = { blocks = { enabled = false } },
desc = "jump to top edge of scope", desc = 'jump to top edge of scope',
}, },
["]a"] = { [']a'] = {
min_size = 1, -- allow single line scopes min_size = 1, -- allow single line scopes
bottom = true, bottom = true,
cursor = false, cursor = false,
edge = true, edge = true,
treesitter = { blocks = { enabled = false } }, treesitter = { blocks = { enabled = false } },
desc = "jump to bottom edge of scope", desc = 'jump to bottom edge of scope',
}, },
}, },
}, },
}, },
scratch = { scratch = {
enabled = true, enabled = true,
name = "SCRATCH", name = 'SCRATCH',
ft = function() ft = function()
if vim.bo.buftype == "" and vim.bo.filetype ~= "" then if vim.bo.buftype == '' and vim.bo.filetype ~= '' then
return vim.bo.filetype return vim.bo.filetype
end end
return "markdown" return 'markdown'
end, end,
icon = nil, icon = nil,
root = vim.fn.stdpath("data") .. "/scratch", root = vim.fn.stdpath('data') .. '/scratch',
autowrite = true, autowrite = true,
filekey = { filekey = {
cwd = true, cwd = true,
branch = true, branch = true,
count = true, count = true,
}, },
win = { win = {
width = 120, width = 120,
height = 40, height = 40,
bo = { buftype = "", buflisted = false, bufhidden = "hide", swapfile = false }, bo = { buftype = '', buflisted = false, bufhidden = 'hide', swapfile = false },
minimal = false, minimal = false,
noautocmd = false, noautocmd = false,
zindex = 20, zindex = 20,
wo = { winhighlight = "NormalFloat:Normal" }, wo = { winhighlight = 'NormalFloat:Normal' },
border = "rounded", border = 'rounded',
title_pos = "center", title_pos = 'center',
footer_pos = "center", footer_pos = 'center',
keys = { keys = {
["execute"] = { ['execute'] = {
"<cr>", '<cr>',
function(_) function(_)
vim.cmd("%SnipRun") vim.cmd('%SnipRun')
end, end,
desc = "Execute buffer", desc = 'Execute buffer',
mode = { "n", "x" }, mode = { 'n', 'x' },
}, },
}, },
}, },
win_by_ft = { win_by_ft = {
lua = { lua = {
keys = { keys = {
["source"] = { ['source'] = {
"<leader>cr", '<leader>cr',
function(self) function(self)
local name = "scratch." local name = 'scratch.'
.. vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self.buf), ":e") .. vim.fn.fnamemodify(vim.api.nvim_buf_get_name(self.buf), ':e')
Snacks.debug.run({ buf = self.buf, name = name }) Snacks.debug.run({ buf = self.buf, name = name })
end, end,
desc = "Source buffer", desc = 'Source buffer',
mode = { "n", "x" }, mode = { 'n', 'x' },
}, },
}, },
}, },
}, },
}, },
scroll = { enabled = false }, scroll = { enabled = false },
statuscolumn = { statuscolumn = {
enabled = false, -- Change this to false enabled = false, -- Change this to false
left = { "mark", "sign" }, left = { 'mark', 'sign' },
right = { "fold", "git" }, right = { 'fold', 'git' },
folds = { folds = {
open = false, open = false,
git_hl = false, git_hl = false,
}, },
git = { git = {
patterns = { "GitSign", "MiniDiffSign" }, patterns = { 'GitSign', 'MiniDiffSign' },
}, },
refresh = 50, refresh = 50,
}, },
terminal = { enabled = false }, terminal = { enabled = false },
toggle = { enabled = false }, toggle = { enabled = false },
win = { enabled = true }, win = { enabled = true },
words = { enabled = false }, words = { enabled = false },
zen = { zen = {
enabled = true, enabled = true,
toggles = { toggles = {
dim = true, dim = true,
git_signs = false, git_signs = false,
mini_diff_signs = false, mini_diff_signs = false,
-- diagnostics = false, -- diagnostics = false,
-- inlay_hints = false, -- inlay_hints = false,
}, },
show = { show = {
statusline = false, statusline = false,
tabline = false, tabline = false,
}, },
win = { style = "zen" }, win = { style = 'zen' },
zoom = { zoom = {
toggles = {}, toggles = {},
show = { statusline = true, tabline = true }, show = { statusline = true, tabline = true },
win = { win = {
backdrop = false, backdrop = false,
width = 0, width = 0,
}, },
}, },
}, },
}) })
end, end,
} }