Skip to content

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

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

Closed
DoctorKnowsBetter opened this issue May 7, 2023 · 2 comments · Fixed by #2198
Closed

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

DoctorKnowsBetter opened this issue May 7, 2023 · 2 comments · Fixed by #2198
Labels
feature request PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated QOL Quality Of Life Improvement

Comments

@DoctorKnowsBetter
Copy link
Contributor

DoctorKnowsBetter commented May 7, 2023

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

@alex-courtis
Copy link
Member

That seems reasonable. A pull request would be gratefully appreciated. See Development

@alex-courtis alex-courtis added PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated QOL Quality Of Life Improvement labels May 8, 2023
@DoctorKnowsBetter
Copy link
Contributor Author

DoctorKnowsBetter commented May 8, 2023

@alex-courtis #2198

alex-courtis added a commit that referenced this issue May 15, 2023
* #2193 Add the ability to change the icon color for "symlink_formatted"

* Remove defaults and update doc #2198

---------

Co-authored-by: DoctorKnowsBetter <[email protected]>
Co-authored-by: Alexander Courtis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated QOL Quality Of Life Improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants