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

Hide specified files or directories #694

Open
1 task done
grig-iv opened this issue Feb 18, 2024 · 7 comments
Open
1 task done

Hide specified files or directories #694

grig-iv opened this issue Feb 18, 2024 · 7 comments
Labels
feature New feature request

Comments

@grig-iv
Copy link
Contributor

grig-iv commented Feb 18, 2024

Is your feature request related to a problem? Please describe

It's nice to have control over file/folder visibility, e.g. folders like Desktop, go and steam in my home directory are an eyesore for me, I would like to hide them, and some people may want to treat their .config as visible folder****

Will you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

There should be an option in yazi.toml where the user can add rules for how to treat certain files and folders. It probably should resides under the [manager] category alongside with show_hidden.

Which is a more intuitive way to represent this option?

  1. An array of patterns with a specification how to treat them
[manager]
visibility_rules = [
    { pattern = "~/.config", visible = true,  }
    { pattern = "~/Desktop", visible = false, }
    { pattern = "~/go"     , visible = false, }
]
  1. Two arrays - one for visible entries, one for hidden entries
[manager]
treat_as_visible = [ "~/.config", ]
treat_as_hidden = [ "~/Desktop", "~/go", ]

Describe alternatives you've considered

No response

Additional context

Requested by @5ouma, #51 (comment)

@grig-iv grig-iv added the feature New feature request label Feb 18, 2024
@grig-iv
Copy link
Contributor Author

grig-iv commented Feb 18, 2024

Also is there already a function for checking url for a pattern?

@sxyazi
Copy link
Owner

sxyazi commented Feb 18, 2024

I think this is a bit too complicated, it's a performance challenge

If there are 10,000 files in the directory and there are 5 rules like this, it will need to match 50,000 times. My idea is that it should just be a simple regular expression, not a set of rules.

@grig-iv
Copy link
Contributor Author

grig-iv commented Feb 18, 2024

Just to be clear, should regex be checked upon filename or full path? And what config type should I use?

@sxyazi
Copy link
Owner

sxyazi commented Feb 19, 2024

Maybe we can have:

[manager]
visibility_rules = [
    { dir = "~/", hide = "go|\.git" },
    { dir = "*/", hide = "\.git" }  # fallback
]

Different hiding patterns (regular expressions) can be set for different directories, and the first matching rule will be applied.

Not quite sure, I need to think about it some more. BTW, are there any other file managers that support configuring this? Maybe we can refer to them.

@jmlucjav
Copy link

Total commander does support this, it's called Ignore list

@sxyazi
Copy link
Owner

sxyazi commented Feb 20, 2024

@jmlucjav Sorry could you be more specific? How does it support it - like, what does the configuration file look like? I haven't used it.

@jmlucjav
Copy link

the easiest would be to paste the help contents...

Configuration - Ignore list Back

Ignore specific files/folders: They will be neither displayed nor copied. Only files in the file system can be ignored. Files on ftp servers, within archives, plugins or virtual folders like the desktop cannot be ignored.

Ignore (don't show) the following files and folders:
Master switch to turn option on and off.
List files and folders which you want to ignore. The following entry types are supported:

  1. Full path to file. Example: c:\config.sys
  2. Path relative to the root of ALL drives. Example: \RECYCLER
  3. Name which will be hidden in all paths. Example: descript.ion
    Notes:
  • All 3 options above also support the wildcards * and ?, e.g. *.br1
  • Multiple names with wildcards can be put on 1 line, separated by space or ";", e.g. *.bak *.old
  • Relative or absolute path items must be put on a separate line each.
  • When a name is ended with a backslash, it will match only directories
  • Attention: If a name contains both spaces and wildcards, it must be written in double quotes the following way: "System Volume*" or c:\path"long name*"

Save in: Location and name where the ignore list will be stored. Default is tcignore.txt

Add selected names with full path
Enabled only when some files are selected in the last active panel of Total Commander. Allows you to add these files/dirs with full path to the above list.

Add selected names Enabled only when some files are selected in the last active panel of Total Commander. Allows you to add these files/dirs without path, which means that they will be hidden in ALL directories.

Note: Use the internal command cm_SwitchIgnoreList to turn this option on and off via a button, menu item, or hotkey.

image

image

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

No branches or pull requests

3 participants