Skip to content

Commit de2a03e

Browse files
committed
feat(yazi): add folder rules plugin for downloads folder rules
1 parent 25aa68b commit de2a03e

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

home/dot_config/exact_yazi/exact_plugins/change-ratio.yazi/main.lua renamed to home/dot_config/exact_yazi/exact_plugins/exact_change-ratio.yazi/main.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ local function entry(_, job)
77
tonumber(job.args[3]),
88
}
99

10-
ya.emit("app:resize", {})
10+
ya.emit('app:resize', {})
1111
end
1212

1313
return { entry = entry }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
local function setup()
2+
ps.sub('cd', function()
3+
local cwd = cx.active.current.cwd
4+
5+
if cwd:ends_with('Downloads') then
6+
ya.mgr_emit('sort', { 'mtime', reverse = true, dir_first = false })
7+
else
8+
ya.mgr_emit('sort', { 'natural', reverse = false, dir_first = true })
9+
end
10+
end)
11+
end
12+
13+
return { setup = setup }

home/dot_config/exact_yazi/init.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local session = require('session')
22
local git = require('git')
33
local zoxide = require('zoxide')
4+
local folder_rules = require('folder-rules')
45

56
session:setup({
67
sync_yanked = true,
@@ -13,3 +14,5 @@ git:setup({
1314
zoxide:setup({
1415
update_db = true,
1516
})
17+
18+
folder_rules:setup()

0 commit comments

Comments
 (0)