Skip to content

No ability to change the icon color for "symlink_formatted" #2193

Closed
@DoctorKnowsBetter

Description

@DoctorKnowsBetter

Dear developers, please consider changes to the Builder:_build_symlink function in $HOME/.local/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/renderer/builder.lua
Otherwise there is no way to change the color of the icon, which can ruin the overall style of the theme.

Original:

function Builder:_build_symlink(node)
  local icon = icons.i.symlink
  local arrow = icons.i.symlink_arrow
  local symlink_formatted = node.name
  if self.symlink_destination then
    local link_to = utils.path_relative(node.link_to, core.get_cwd())
    symlink_formatted = symlink_formatted .. arrow .. link_to
  end

  local link_highlight = "NvimTreeSymlink"

  return { str = icon }, { str = symlink_formatted, hl = link_highlight }
end

Modify:

function Builder:_build_symlink(node)
  local icon = icons.i.symlink
  local arrow = icons.i.symlink_arrow
  local symlink_formatted = node.name
  if self.symlink_destination then
    local link_to = utils.path_relative(node.link_to, core.get_cwd())
    symlink_formatted = symlink_formatted .. arrow .. link_to
  end

  local link_highlight = "NvimTreeSymlink"
  local icon_hl = "NvimTreeSymlinkIcon"                                                     <----

  return { str = icon, hl = icon_hl  }, { str = symlink_formatted, hl = link_highlight }    <----
end

Here's the problem:

Untitled

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR pleasenvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciatedQOLQuality Of Life Improvementfeature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions