-
Notifications
You must be signed in to change notification settings - Fork 640
feat: folder-specific file exclusion rules #3266
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
base: main
Are you sure you want to change the base?
Conversation
|
The companion documentation PR has been updated at yazi-rs/yazi-rs.github.io#294 |
671e952 to
6107a47
Compare
|
Hi @sxyazi ... any news on this? :) |
|
Hi guys, I was trying out the branch on the current state and it works well. I was wondering; if this option is removed Then the objective would be to delegate the .gitignore responsibility to a plugin? Honestly, I think the way it's currently implemented is the right move, because from a user perspective, that was the only thing that I thought that yazi lacked, hiding git ignore files. I just want to advocate to refine the PR as requested by @sxyazi but keep the git ignore feature builtin. I know it is maintenance cost and I don't want to sound entitled, but I think it's a really useful feature when using yazi on Helix or Neovim, for example. I'd involve myself in the process but I simply lack the Rust skills to do so at the moment. Thanks btw |
|
I agree with @and-rs and think the addition of gitignore only bring gains and ease the burden of big part of the user base with almost no effort. |
|
Yes, I plan to implement it as a plugin. I don't really see the problem with implementing it as a plugin, because from the user's perspective, you just need to install it and simply enable it to start using it, just like the existing If installing plugins is a challenge, we can also bundle it in, distributing it to users as a preset plugin just like all other Yazi preset plugins, the user would just need to enable it, and the experience would be no different from having it implemented in Rust. However, it's best to maintain it in a separate repository at first, so it isn't tied to Yazi's release cycle and can get bug fixes more promptly - in Yazi, plugins are first-class citizens, and most features are provided through plugins from the inside out. Technically, loading and parsing gitignore files involves IO operations, so it should be implemented as a fetcher in an asynchronous way to avoid blocking the main thread (the current implementation is synchronous). In Yazi, all IO operations are and should be asynchronous, and fetchers exist for exactly this purpose: they load external information and transform sync into async, but fetchers are built around Lua and can only exist as plugins - there is no equivalent infrastructure available in Rust. It could also be maintained as a community fork if "implemented in Rust" is a concern here - not all features need to be upstreamed, and I encourage users to maintain their forks to fit their own needs, and I can link these forks in the documentation so others interested in the future can use or help maintain them. |
|
I'm looking into reverting the gitignore config. Which tool is used for toml formatting as taplo automatically formats it as now. |
|
Don't format the toml files, only add or modify necessary parts
…On Wed, Oct 29, 2025 at 6:54 AM Carlos Eduardo ***@***.***> wrote:
*carlosedp* left a comment (sxyazi/yazi#3266)
<#3266 (comment)>
I'm looking into reverting the gitignore config. Which tool is used for
toml formatting as taplo automatically formats it as now.
—
Reply to this email directly, view it on GitHub
<#3266 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEFWFICAAE4YKKT75PZGJSL3Z7X3PAVCNFSM6AAAAACJW2BN42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTINJYHA3TINRZGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Just pushed the changes. |
|
Hold the review a bit. I'll push a commit later today which adds API to allow the use of exclusion by plugins and also the lua plugin to load gitignore files from repos. |
|
The latest commit adds the API allowing Lua plugins to add exclude patterns to the processing. Patterns from As a companion, I've created the |
|
Btw @and-rs ... if you can test this out with the plugin I'd love to get some feedback... :) |
|
I'm already looking into this... Facing a problem when e browsing a git repo subdir and going back... Something about yazi caching the repo and not calling the fetcher to update the files. This brief "flashing" you see is normal since the fetcher is async and when opening a dir the file is shown until the plugin returns and yazi hides it. Tips @sxyazi ? |
|
Any reason to fetch multiple times? For better performance, Yazi marks
files that have already been fetched as no longer needing to be fetched
again since that's a time-consuming operation unless there are changes to
those files
…On Fri, Oct 31, 2025 at 8:54 AM Carlos Eduardo ***@***.***> wrote:
*carlosedp* left a comment (sxyazi/yazi#3266)
<#3266 (comment)>
I'm already looking into this... Facing a problem when e tearing a git
repo subdir and going back... Something about yazi caching the dirt and not
calling the fetcher to update the files.
This brief "flashing" you see is normal since the fetcher is async and
when opening a dir the file is shown until the plugin returns and yazi
hides it.
Tips @sxyazi <https://github.com/sxyazi> ?
—
Reply to this email directly, view it on GitHub
<#3266 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEFWFIDV3N4FJPW566WP4C332KXNJAVCNFSM6AAAAACJW2BN42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTINZQHA3TONJTGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Fixed the caching issue and updated the plugin as well since it had a pattern matching problem. Can you test this out @and-rs? It needs to pull and build this new commit and update the plugin from it's repo. |
|
@and-rs I override my config with yours and here it's working fine: Untitled.video.-.Made.with.Clipchamp.2.mp4I have git.yazi too and it's not working with the upstream main branch (not related to my changes)... I've noticed many other issues with nightly like some flavors (Dracula). Yatline plugin is broken too. Maybe @sxyazi can chime in about this and if there's a guide on deprecations so plugin owners fix them. |
|
Btw, have you tried to clean cache with |
- Introduced `Ignore` actor to manage ignore patterns based on gitignore and user-defined overrides. - Implemented `IgnoreFilter` to handle ignored paths and patterns. - Updated `Files` struct to include an ignore filter, allowing files to be filtered based on ignore rules. - Modified existing actors and managers to apply ignore filters during file operations. - Updated `Cargo.toml` and `Cargo.lock` to include new dependencies related to ignore functionality.
…xclude patterns externally
|
I'll take a look at it later today. It might be the cache or maybe nested .gitignores like the repo I testing it in? Idk but I'll be trying it out soon. Ty |
|
Great, I just rebased it on latest changes. @sxyazi any additional corrections to the code? Have you been able to review it? |
|
Hey there, I just updated the branch and cleaned the cache with no success. Hmmm it seems like this part of the code is causing it.
[files]
excludes = [
{ urn = ".git", in = "*" },
{ urn = "!.env", in = "*" },
]Edit: I just realized it could be the .git dir getting hidden. Because it shifts the first panel's results one entry, if that makes sense. So when it's hidden, the current directory doesn't get updated, but the entries get shifted. Perhaps if this will help you test it, this is the repo I am testing with. https://github.com/and-rs/tiramisu 2025-11-04.19-27-19.mp4 |
|
No error here... even on the tiramisu repo, the path is shown correctly. I've added/removed exclude patterns and no changes (except it shows .git when removed). Have you also updated the gitignore.yazi plugin in your plugins folder? |
|
The latest commit adds an Add to your [[mgr.prepend_keymap]]
on = "<A-e>"
run = "excluded toggle"
desc = "Toggle excluded files visibility"The |
|
Hey @and-rs, as an aside, to fix git.yazi plugin update your config to: Yazi nightly now uses |
|
thanks for the fix, I haven't had issues with the keymap btw so that's great. although I find it weird that you couldn't replicate the other bug. I did some more testing and found out it's also related with show_hidden option. I have the latest commit on both the plugin and yazi 2025-11-06.13-36-03.mp4 |
|
@carlosedp I made a pull request on your fork that fixes the bug, it's pretty small |
…uded state handling
fix: cursor not positioned correctly at init
…dur to compilation errors
|
Thanks a lot @and-rs! Merged it into the PR and also some minor fixes after rebasing latest upstream commits. |



This pull request introduces a file exclude system to the file manager, adding support for custom ignore patterns per path. It enables users to control which files and directories are hidden from view. The changes span configuration, core logic, and integration with the actor and file management systems. The PR also contemplates the API to support rules from Lua plugins which can be used to provide exclusions like gitignores.
Configuration and Integration
New [files] configuration to include
excludessettings, allowing users to specify custom ignore patterns.Sample configuration:
The config also adds a
excludedcommand which allows to toggle, hide and show the excluded files.Add to your
keymap.toml:The
excludedcommand acceptstoggle,showandhide.These changes collectively add robust and flexible ignore filtering, enhancing the file manager's ability to hide unwanted files and directories according to user preferences and project standards as explained in #3257 (comment).
There are companion PRs and repos to this PR: