Skip to content

feat(#3113): add renderer.icons.folder_arrow_padding #3114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions doc/nvim-tree-lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,10 @@ Following is the default configuration. See |nvim-tree-opts| for details. >lua
hidden_placement = "after",
diagnostics_placement = "signcolumn",
bookmarks_placement = "signcolumn",
padding = " ",
padding = {
icon = " ",
folder_arrow = " ",
},
symlink_arrow = " ➛ ",
show = {
file = true,
Expand Down Expand Up @@ -1065,10 +1068,14 @@ Configuration options for icons.
Bookmark icon placement.
Type: `string`, Default: `signcolumn`

*nvim-tree.renderer.icons.padding*
*nvim-tree.renderer.icons.padding.icon*
Inserted between icon and filename.
Type: `string`, Default: `" "`

*nvim-tree.renderer.icons.padding.folder_arrow*
Inserted between folder arrow icon and file/folder icon.
Type: `string`, Default: `" "`

*nvim-tree.renderer.icons.symlink_arrow*
Used as a separator between symlinks' source and target.
Type: `string`, Default: `" ➛ "`
Expand Down Expand Up @@ -3027,6 +3034,7 @@ needed.
`sort_by` |nvim-tree.sort.sorter|
`git.ignore` |nvim-tree.filters.git_ignored|
`renderer.icons.webdev_colors` |nvim-tree.renderer.icons.web_devicons.file.color|
`renderer.icons.padding` |nvim-tree.renderer.icons.padding.icon|

==============================================================================
14.2 LEGACY: HIGHLIGHT *nvim-tree-legacy-highlight*
Expand Down Expand Up @@ -3183,7 +3191,8 @@ highlight group is not, hard linking as follows: >
|nvim-tree.renderer.icons.glyphs.symlink|
|nvim-tree.renderer.icons.hidden_placement|
|nvim-tree.renderer.icons.modified_placement|
|nvim-tree.renderer.icons.padding|
|nvim-tree.renderer.icons.padding.folder_arrow|
|nvim-tree.renderer.icons.padding.icon|
|nvim-tree.renderer.icons.show|
|nvim-tree.renderer.icons.show.bookmarks|
|nvim-tree.renderer.icons.show.diagnostics|
Expand Down
5 changes: 4 additions & 1 deletion lua/nvim-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,10 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
hidden_placement = "after",
diagnostics_placement = "signcolumn",
bookmarks_placement = "signcolumn",
padding = " ",
padding = {
icon = " ",
folder_arrow = " ",
},
symlink_arrow = " ➛ ",
show = {
file = true,
Expand Down
7 changes: 7 additions & 0 deletions lua/nvim-tree/legacy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ local function refactored(opts)
end
end
utils.move_missing_val(opts, "update_focused_file", "ignore_list", opts, "update_focused_file.update_root", "ignore_list", true)

-- 2025/04/30
if opts.renderer and opts.renderer.icons and type(opts.renderer.icons.padding) == "string" then
local icons_padding = opts.renderer.icons.padding
opts.renderer.icons.padding = {}
opts.renderer.icons.padding.icon = icons_padding
end
end

local function deprecated(opts)
Expand Down
2 changes: 1 addition & 1 deletion lua/nvim-tree/renderer/builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function Builder:format_line(indent_markers, arrows, icon, name, node)
end
for _, v in ipairs(t2) do
if added_len > 0 then
table.insert(t1, { str = self.explorer.opts.renderer.icons.padding })
table.insert(t1, { str = self.explorer.opts.renderer.icons.padding.icon })
end
table.insert(t1, v)
end
Expand Down
6 changes: 3 additions & 3 deletions lua/nvim-tree/renderer/components/padding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ function M.get_arrows(node)
local dir = node:as(DirectoryNode)
if dir then
if dir.open then
str = M.config.icons.glyphs.folder["arrow_open"] .. " "
str = M.config.icons.glyphs.folder["arrow_open"] .. M.config.icons.padding.folder_arrow
hl = "NvimTreeFolderArrowOpen"
else
str = M.config.icons.glyphs.folder["arrow_closed"] .. " "
str = M.config.icons.glyphs.folder["arrow_closed"] .. M.config.icons.padding.folder_arrow
end
elseif M.config.indent_markers.enable then
str = ""
else
str = " "
str = " " .. string.rep(" ", #M.config.icons.padding.folder_arrow)
end

return { str = str, hl = { hl } }
Expand Down