diff --git a/yazi/.config/yazi/keymap.toml b/yazi/.config/yazi/keymap.toml index d4275d7..e3fc29a 100644 --- a/yazi/.config/yazi/keymap.toml +++ b/yazi/.config/yazi/keymap.toml @@ -1,7 +1,7 @@ [manager] prepend_keymap = [ { on = [ "l" ], run = "plugin --sync smart-enter", desc = "Enter the child directory, or open the file" }, - { on = [ "L" ], run = "plugin --sync sudoedit", desc = "Enter the child directory, or open the file" }, + { on = [ "L" ], run = "plugin --sync sudoedit", desc = "Edit the file with sudoedit" }, { on = [ "q" ], run = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" }, { on = [ "Q" ], run = "quit", desc = "Exit the process" }, diff --git a/yazi/.config/yazi/plugins/sudoedit.yazi/init.lua b/yazi/.config/yazi/plugins/sudoedit.yazi/init.lua index 3841fc0..092f642 100644 --- a/yazi/.config/yazi/plugins/sudoedit.yazi/init.lua +++ b/yazi/.config/yazi/plugins/sudoedit.yazi/init.lua @@ -1,9 +1,14 @@ return { entry = function(_, _) - ya.manager_emit("shell", { - 'sudoedit "$@"', - block = true, - confirm = true, - }) + local h = cx.active.current.hovered + if h and h.cha.is_dir then + ya.manager_emit("enter", {}) + else + ya.manager_emit("shell", { + 'sudoedit "$@"', + block = true, + confirm = true, + }) + end end }