[Feature Request] Ignore files in .hidden
Some Linux file managers hide files and folders listed in a file named .hidden, which can be useful for those cases when you can't change the name of the file or folder. It would be cool if exa could do this.
I would vote for this feature to be opt-in if it was implemented.
I disagree.
I'm not aware of any standard preventing me from creating a file with that name without any further intentions. I would expect the file .hidden to be hidden as it itself is a dot file. I would not expect any tool to just parse that file and change its behaviour based on that.
Have you checked how many tutorials out there explain dot files by creating file called .hiddenand then listing the directory content with ls and ls -a?
And what happens if I open a directory with a symbolic link called .hidden that points to /dev/random in one of the file browsers supporting this? :wink:
The closest thing I could come up with on the spot is .git but this is very well spread knowledge amongst the git user base while many exa users see it as a fancy ls replacement without digging into the details. Furthermore, it is required for the core functionality of git and creating e.g. empty .git file results in a meaningful error message. Finally, users usually only attempt to run git inside a git-repository, i.e. a place where the .git directory was intentionally created by a .git command. If I don't know about git but just want to have a file called .git with whatever content I like, it won't ever be parsed as I won't run git commands from within that directory.
With exa however, many people not knowing about that feature will routinely run it in all kids of directories. This could cause unexpected behaviour and IMHO should therefore be strictly opt-in.
If a user knows about this feature and wants to use it, it is trivial to alias the corresponding command line flag as default. If you already go ahead an create .hidden files, this one extra step (once!) is negligible as a 'cost', especially if it protects the (potentially many more) users not knowing/caring about that (new) feature (and if only from unnecessary checking for and parsing of whatever file they called .hidden).
Well if you happen to have a file or symlink in a directory named the exact thing most file managers read, I don't think exa is your biggest problem, this is embedded in gtk and KDE file pickers, file managers, almost everything but ls reads this by default already, at this point it's as universal as it can be without being a strict standard.
But a config option is better than nothing.
@ShayBox: I think you vastly underestimat the proportion of ls (and therfore potentially exa) users that work without gtk, KDE, X, Wayland, whatever. :wink:
I use ls on any SSH box I have access, almost all of them not connected to a screen.
If exa is recommended for Desktop usage only, this should be clearly stated.
I'll note here that I think rg and fd respect .ignore files by default.
I can’t find any standard about this. It works on Nautilus, Nemo and Thunar, but not in Dolphin (I just tested it), and I guess the file is supposed to contain globs but what kind?
If I were to be convinced of giving it a try to implement this, it wouldn’t be the default behavior though since I don’t think it’s well-known, and someone liking this behavior could easily set up an alias anyway.
What about aliasing exa as:
newls(){
if [ -f ".hidden" ]
then
exa --git-ignore -I $(tr '\n' '|' < .hidden) $@
else
exa --git-ignore $@
fi
}
alias ls=newls