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

feat: hide specified files and dirs #2089

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

TobisLee
Copy link
Contributor

Try to fix #694.

Works with the given regex string:
https://github.com/TobisLee/yazi/blob/2fdd7b6f554dd4e15648ed8f611bd83cedd511c8/yazi-shared/src/url/urn.rs#L22
but failed with hidden_rule config:
https://github.com/TobisLee/yazi/blob/2fdd7b6f554dd4e15648ed8f611bd83cedd511c8/yazi-shared/src/url/urn.rs#L23

Cargo shows

error: cyclic package dependency: package `yazi-config v0.4.3 (/home/tlss/repos/rust_project/yazi/yazi-config)` depends on itself. Cycle:
package `yazi-config v0.4.3 (/home/tlss/repos/rust_project/yazi/yazi-config)`
    ... which satisfies path dependency `yazi-config` (locked to 0.4.3) of package `yazi-shared v0.4.3 (/home/tlss/repos/rust_project/yazi/yazi-shared)`
    ... which satisfies path dependency `yazi-shared` (locked to 0.4.3) of package `yazi-fs v0.4.3 (/home/tlss/repos/rust_project/yazi/yazi-fs)`
    ... which satisfies path dependency `yazi-fs` (locked to 0.4.3) of package `yazi-config v0.4.3 (/home/tlss/repos/rust_project/yazi/yazi-config)`
    ... which satisfies path dependency `yazi-config` (locked to 0.4.3) of package `yazi-adapter v0.4.3 (/home/tlss/repos/rust_project/yazi/yazi-adapter)`

@Laughing-q
Copy link

@sxyazi Hi! Thanks for your awesome work on this awesome file manager! Wanted to push this feature a little bit more here haha, recently I'm switching my primary file manager from lf to yazi, and as a python developer I really want to hide the annoying __pycache__ folders and files.
I used to use set hiddenfiles .*:__pycache__:*.pyc to hide it in lf manager. It'd be perfect if yazi has similar option to do so! Thanks!
jsSpPZr59Z

@sxyazi
Copy link
Owner

sxyazi commented Dec 31, 2024

@TobisLee This feature should not be implemented in yazi-shared/src/url/urn.rs because yazi-shared is a fairly low-level crate that provides shared functions and should not contain any business-related code.

You need to implement it in yazi-fs/src/files.rs and add it as a field in Files, similar to the existing filter: Option<Filter>:

filter: Option<Filter>,

Then, pass it from the outside, just like what the set_filter method does:

pub fn set_filter(&mut self, filter: Option<Filter>) -> bool {

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

Successfully merging this pull request may close these issues.

Hide specified files or directories
3 participants