nvim-neo-tree / neo-tree.nvim

Neovim plugin to manage the file system and other tree like structures.
MIT License
3.93k stars 227 forks source link

FEATURE: Always show files tracked by git #1154

Open fschoenm opened 1 year ago

fschoenm commented 1 year ago

Did you check the docs?

Is your feature request related to a problem? Please describe.

I tried to find a solution but it doesn't seem possible at the moment?

I know that I can manually add some hidden files to the always_show list of files/directories but there doesn't seem to be a way to always show all files that are tracked by git but still hide untracked dotfiles or other hidden files.

Describe the solution you'd like.

Add a mode always_show_git_tracked or similar to show files that are tracked by git.

Describe alternatives you've considered.

No response

Additional Context

No response

wookayin commented 1 year ago

+1

Or use additional option for hide_dotfiles rather than creating a new option:

  filtered_items = {
          hide_dotfiles = true,  -- true(='always') | 'untracked' | false(='never')
  }

My proposal is to have hide_dotfiles = "untracked" by default, i.e., hide a .dotfile if it is untracked. If it's git-tracked or not-git-ignored, then the files won't be hidden. This should also be the sensible default behavior.

cseickel commented 1 year ago

The problem I have with that is that it seems like complexity we have already solved with the always_show option. Wouldn't the dotfiles that are tracked by git be a very limited set of files with known names?

https://github.com/nvim-neo-tree/neo-tree.nvim/blob/7e2a3caf999e2028abb643eb0472f351b2777591/lua/neo-tree/defaults.lua#L472-L474

I would prefer adding an always_show_by_pattern feature if that is enough to handle the real world examples of dotfiles tracked by git.

wookayin commented 1 year ago

The files that should be shown are project-dependent and therefore it doesn't make much sense to put the list of such files into neovim configs. The information has to be read (during runtime) from the git repository (like git ls-files). I believe this problem is closer to controlling the degree of hiding .dotfiles taking git VCS into account.

fschoenm commented 1 year ago

There can be a lot of patterns for dotfiles, depending on which project types you're working with. Maybe you even want to commit sometimes your project configuration dotfiles and sometimes not.

IMO using git tracked files is a very user friendly, common sense solution for this problem that has the added benefit that it works out of the box.

cseickel commented 1 year ago

OK, you've convinced me. I think @wookayin's suggestion make sense:https://github.com/nvim-neo-tree/neo-tree.nvim/issues/1154#issuecomment-1743318651

If someone wants to implement this, I will accept the PR. It's not a high priority for me personally though so I don't think I would get to it any time soon.