Skip to content

Commit

Permalink
docs: update tips.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Sep 30, 2024
1 parent e573dd5 commit d8604b6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docs/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,18 @@ You can subscribe to directory change events through the [`cd` event provided by
The following code demonstrates making the `Downloads` directory to sort by modification time, while others are sorted alphabetically. Save these lines as `~/.config/yazi/plugins/folder-rules.yazi/init.lua`:

```lua
return {
setup = function()
ps.sub("cd", function()
local cwd = cx.active.current.cwd
if cwd:ends_with("Downloads") then
ya.manager_emit("sort", { "modified", reverse = true, dir_first = false })
else
ya.manager_emit("sort", { "alphabetical", reverse = false, dir_first = true })
end
end)
end,
}
local function setup()
ps.sub("cd", function()
local cwd = cx.active.current.cwd
if cwd:ends_with("Downloads") then
ya.manager_emit("sort", { "modified", reverse = true, dir_first = false })
else
ya.manager_emit("sort", { "alphabetical", reverse = false, dir_first = true })
end
end)
end

return { setup = setup }
```

Then enable it in your `~/.config/yazi/init.lua`:
Expand Down

0 comments on commit d8604b6

Please sign in to comment.