mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 11:18:26 +00:00
feat(picker): allow configuring file icon width. Closes #981
This commit is contained in:
parent
4362b1cbe0
commit
52c1086ecd
2 changed files with 3 additions and 2 deletions
|
@ -143,6 +143,7 @@ local defaults = {
|
|||
filename_first = false, -- display filename before the file path
|
||||
truncate = 40, -- truncate the file path to (roughly) this length
|
||||
filename_only = false, -- only show the filename
|
||||
icon_width = 2, -- width of the icon (in characters)
|
||||
},
|
||||
selected = {
|
||||
show_always = false, -- only show the selected column when there are multiple selections
|
||||
|
|
|
@ -61,8 +61,8 @@ function M.filename(item, picker)
|
|||
if item.dir and item.open then
|
||||
icon = " "
|
||||
end
|
||||
local padded_icon = icon:sub(-1) == " " and icon or icon .. " "
|
||||
ret[#ret + 1] = { padded_icon, hl, virtual = true }
|
||||
icon = Snacks.picker.util.align(icon, picker.opts.formatters.file.icon_width or 2)
|
||||
ret[#ret + 1] = { icon, hl, virtual = true }
|
||||
end
|
||||
|
||||
local base_hl = item.dir and "SnacksPickerDirectory" or "SnacksPickerFile"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue