helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.42k stars 2.48k forks source link

File picker should have an option to display ignored files #280

Closed valignatev closed 2 years ago

valignatev commented 3 years ago

Helix can't open files that are in the home directory and in some other directories. Can't quite tell the pattern, but in some directories helix just doesn't open any existing files. As in it doesn't show suggestions. It opens the file if I type its name manually with the relative path, but it can't open the file if I type its path like ~/.vimrc, e.g. with leading tilde. It says "NOR" and a path to the file image

Environment

Log file is empty

pickfire commented 3 years ago

Seemed to work for me, is your ~/.vimrc empty? I am using arch as well, I tried both v0.2.0 and a364d6c3837c36225dcd4ec9b15ef2c192feef0b. Did you use the one in AUR? How did you install or test it out?

valignatev commented 3 years ago

yeah just helix-bin from AUR. My vimrc has content. Again, it opens when I manually type it out like :open .vimrc, and shows the content, but it doesn't open it if I type :open ~/.vimrc.

sudormrfbin commented 3 years ago

yeah just helix-bin from AUR. My vimrc has content. Again, it opens when I manually type it out like :open .vimrc, and shows the content, but it doesn't open it if I type :open ~/.vimrc.

I can reproduce this on master. Seems like an issue with expanding ~.

valignatev commented 3 years ago

I believe this isn't fixed still. While ~ gets expanded to the home directory now, no suggestions for the files are shown. hx --version is 0.3

This is what space f shows when hx is launched from the home directory image

archseer commented 3 years ago

You need to add a trailing slash: ~/ shows results for me.

valignatev commented 3 years ago

It doesn't for me image

archseer commented 3 years ago

Weird, is your home directory a symlink maybe?

valignatev commented 3 years ago

It's an absolute path

archseer commented 3 years ago

And ~ is the only path that has these issues?

archseer commented 3 years ago

The file picker follows .gitignore/ignorefile rules, maybe that's the issue?

https://github.com/helix-editor/helix/blob/51162ae6b2f57a38b5878670bf6524b24b5604e6/helix-term/src/ui/mod.rs#L76-L129

valignatev commented 3 years ago

Oh yeah that's definitely it, my home directory is a git repo with * in gitignore and forcibly added files that I track: https://github.com/valignatev/dotfiles/blob/master/.gitignore

I would never have guessed that "git project" is the default behavior for helix and it strictly obeys gitignore like that :)

pickfire commented 3 years ago

@archseer Yeah, another person like me which use .git for home directory, which is why I say we stop the .git search until the home directory or root directory.

@valignatev One suggestion I can say is used another directory for git. But yeah, that's a temporary solution for just helix. That's also good because it can hide my prompt. Now I just alias home so it is ~/.home rather than ~/.git so stuff don't seemed weird sometimes, and my prompt also does not show the branch for git when at home directory:

alias home 'git --work-tree=/home/ivan --git-dir=/home/ivan/.home'
valignatev commented 3 years ago

haha, no thanks, there is no benefit for me to introduce this complexity just to make some text editor work :)

But yeah, probably @pickfire's suggestion to not blindly obey gitignore is a good idea. Generally, even aside from dotfiles case, there are lots of cases when people want to comfortably browse their gitignored files - I browse node_modules, or zig_cache, or rust's cache all the time when I do my development, and those directories are almost always gitignored.

pickfire commented 3 years ago

there are lots of cases when people want to comfortably browse their gitignored files

I almost never do this unless I just press "goto declaration" or sort. We could maybe add a flag in file picker to allow browsing through hidden files.

archseer commented 3 years ago

Specifically in the case of the home dir, the recommendation is to use something like rcm (https://github.com/thoughtbot/rcm) or homesick. You'll definitely have issues with more than just Helix otherwise. https://askubuntu.com/questions/1316229/is-it-bad-practice-to-git-init-in-the-home-directory-to-keep-track-of-dot-files

But yes, Helix should have an option to run a filepicker without the ignore flags.

valignatev commented 3 years ago

I'm using this approach to manage my home directory for many years already and this is the first time something ever conflicted with it. I've used rcm and bare git repositories in the past, but all other solutions had some problems I didn't want to deal with, so I switched to this current setup that proved to be the best over the years. I'm definitely not the only one who does the same thing, here's another example: https://drewdevault.com/2019/12/30/dotfiles.html that I can recall off the top of my head.

Regardless, I think that discussions about best practices in managing dotfiles might be slightly offtopic for the issue since it seems to be related not only to the home directory, but generally to the topic of browsing ignored files.

kirawi commented 3 years ago

I believe someone else recently had this issue on Matrix.

kirawi commented 3 years ago

Capture Having something like this would be nice.