Skip to content
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

[Feature Request] Ignore files in .hidden #470

Open
VichoReyes opened this issue Jan 17, 2019 · 7 comments
Open

[Feature Request] Ignore files in .hidden #470

VichoReyes opened this issue Jan 17, 2019 · 7 comments

Comments

@VichoReyes
Copy link
Contributor

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.

@mschilli87
Copy link

I would vote for this feature to be opt-in if it was implemented.

@mschilli87
Copy link

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? 😉

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).

@ShayBox
Copy link

ShayBox commented Jan 6, 2020

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.

@mschilli87
Copy link

mschilli87 commented Jan 6, 2020

@ShayBox: I think you vastly underestimat the proportion of ls (and therfore potentially exa) users that work without gtk, KDE, X, Wayland, whatever. 😉
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.

@AndydeCleyre
Copy link

I'll note here that I think rg and fd respect .ignore files by default.

@ariasuni
Copy link
Collaborator

ariasuni commented Jan 1, 2021

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.

@Koushikphy
Copy link

Koushikphy commented Dec 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants