From d8604b6aae6b95c518c2d1ddbeb2ada18b044ad4 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Mon, 30 Sep 2024 09:39:32 +0800 Subject: [PATCH] docs: update tips.md --- docs/tips.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/tips.md b/docs/tips.md index 809ecdef..1fbe647e 100644 --- a/docs/tips.md +++ b/docs/tips.md @@ -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`: