Skip to content

fix: symlink file icons rendered when renderer.icons.show.file = false, folder.symlink* was incorrectly rendered as folder.default|open #2983

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

Merged
merged 2 commits into from
Nov 3, 2024
Merged
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
6 changes: 5 additions & 1 deletion lua/nvim-tree/renderer/builder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ function Builder:build_symlink(node)
symlink_formatted = string.format("%s%s%s", symlink_formatted, arrow, link_to)
end

return { str = icon, hl = { "NvimTreeSymlinkIcon" } }, { str = symlink_formatted, hl = { "NvimTreeSymlink" } }
if self.opts.renderer.icons.show.file then
return { str = icon, hl = { "NvimTreeSymlinkIcon" } }, { str = symlink_formatted, hl = { "NvimTreeSymlink" } }
else
return { str = "", hl = {} }, { str = symlink_formatted, hl = { "NvimTreeSymlink" } }
end
end

---@private
Expand Down
2 changes: 1 addition & 1 deletion lua/nvim-tree/renderer/components/icons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end
---@return string icon
---@return string? name
local function get_folder_icon_default(node, has_children)
local is_symlink = node.links_to ~= nil
local is_symlink = node.link_to ~= nil
local n
if is_symlink and node.open then
n = M.config.glyphs.folder.symlink_open
Expand Down
Loading