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
Folder-local options for the file manager #623
Labels
feature
New feature request
Comments
Sounds good to me. Maybe we can have: [folder]
rules = [
{ name = "Downloads/", sort_by = "modified", sort_reverse = true, preload = false, ... }
] to keep the same style as others. |
With the introduction of DDS I can now achieve a basic version using the plugin system: -- ~/.config/yazi/plugins/folder-rules.yazi/init.lua
return {
setup = function()
ps.sub("cd", function()
local dir = tostring(cx.active.current.cwd)
if string.find(dir, "Downloads") then
ya.manager_emit("sort", { "modified", reverse = true, dir_first = true })
else
ya.manager_emit("sort", { "alphabetical", reverse = false, dir_first = true })
end
end)
end,
} -- ~/.config/yazi/init.lua
require("folder-rules"):setup() But I’m uncertain about how much overhead there would be compared to when it’s implemented in Rust. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe
First of all, thank you very much for this awesome project! I am impressed by Yazi's speed as well as features. I currently use lf and would love to switch over.
One feature that I really like in lf is the ability to set properties only in a specific directory. For example, we can use time-based sorting for say the Downloads directory while keeping natural sorting for all other directories. I think that would be a a nice addition to Yazi.
Will you be willing to contribute this feature?
Describe the solution you'd like
There should be an option to specify directory-specific settings in
yazi.toml
. Probably we can add a list of directory, settings table under the[manager]
.An example:
If the directory name ends with a slash, the settings would be applied to its sub-directories as well.
A related feature would be a global option to make sorting commands always be directory-local. Usually, when I sort the files in a directory, I don't want the sorting to persist when I go to the parent directory. So this option would be quite useful to me.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: