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

Utilize .gitignore outside of Git repositories #6909

Open
cvengler opened this issue Apr 29, 2023 · 5 comments · May be fixed by #6923 or #12484
Open

Utilize .gitignore outside of Git repositories #6909

cvengler opened this issue Apr 29, 2023 · 5 comments · May be fixed by #6923 or #12484
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR

Comments

@cvengler
Copy link

cvengler commented Apr 29, 2023

It would amazing, if the .gitignore file would be parsed, even if the directory is not a Git repository.

Certain projects do not use Git, but have a .gitignore in their source tree for exactly this reason. OpenBSD is a good example for it.

@cvengler cvengler added the C-enhancement Category: Improvements label Apr 29, 2023
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Apr 29, 2023
@pascalkuthe
Copy link
Member

pascalkuthe commented Apr 30, 2023

All that's needed to implement this is to add a require_git setting to the file picker settings so you can control ignore::WalkBuilder::require_git. That setting default to true in ignore which is the reason why gitignore file outside of git repositories are ignored.

Note that we support global gitignore rules1 so setting this to false would cause those to be always active aswell so if we make this configurable in helix it should still default to true

Footnotes

  1. well partially, ignore isn't particularly compliant with git

@pascalkuthe pascalkuthe added E-easy Call for participation: Experience needed to fix: Easy / not much E-good-first-issue Call for participation: Issues suitable for new contributors E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR labels Apr 30, 2023
@sscheele
Copy link
Contributor

I can work on this over the next day or two!

@sscheele
Copy link
Contributor

sscheele commented May 1, 2023

I've created a pull request with this feature!

@Niketin Niketin linked a pull request Jun 3, 2023 that will close this issue
@pascalkuthe pascalkuthe removed the E-good-first-issue Call for participation: Issues suitable for new contributors label Jul 3, 2023
@janos-r
Copy link
Contributor

janos-r commented Sep 19, 2024

I just want to note, that even currently, outside of a git folder, .ignore is correctly applied by default. Which is probably what most people want when looking for this.
Either way, this would be a simple and good addition. That whole ignore crate looks great.

@tskardal
Copy link

tskardal commented Oct 20, 2024

I took jj (jujutsu) for a spin this weekend, and noticed that Helix ignored .gitignore (🥁). Jujutsu uses .gitignore too, and even though it is git compatible, it has its own .jj folder instead of .git.

I worked around this by symlinking .gitignore as .ignore, but it would be nice if it was picked up automatically even though its not really a git repo.

Unsure about how often you have a .gitignore that you don't want to affect Helix. Maybe a better default would be to always parse .gitignore.

@kirawi kirawi linked a pull request Jan 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants