From 6dec3bf52d552cf1eb55cfd5103962eca65e45f5 Mon Sep 17 00:00:00 2001 From: aloslider <53711835+aloslider@users.noreply.github.com> Date: Sun, 26 Jul 2026 19:13:30 +0300 Subject: [PATCH] [yazi] Add nav in parent dir --- dot_config/yazi/keymap.toml | 34 +++++++++++++++---- .../yazi/plugins/parent-arrow.yazi/main.lua | 12 +++++++ 2 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 dot_config/yazi/plugins/parent-arrow.yazi/main.lua diff --git a/dot_config/yazi/keymap.toml b/dot_config/yazi/keymap.toml index 565f13f..076d6a1 100644 --- a/dot_config/yazi/keymap.toml +++ b/dot_config/yazi/keymap.toml @@ -1,7 +1,27 @@ -[mgr] -prepend_keymap = [ - { on = "\\", run = "plugin split-tabs spl_toggle", desc = "Dual-pane: toggle" }, - { on = "", run = "plugin split-tabs spl_switch_tab", desc = "Dual-pane: switch pane" }, - { on = "P", run = "plugin split-tabs spl_preview", desc = "Dual-pane: toggle bottom preview" }, - { on = "", run = "shell -- rofi -theme fullscreen-preview -show filebrowser -filebrowser-command \"ya emit reveal\" -filebrowser-directory \"$(pwd)\"", desc = "Grid view" }, -] +[[mgr.prepend_keymap]] +on = "\\" +run = "plugin split-tabs spl_toggle" +desc = "Dual-pane: toggle" + +[[mgr.prepend_keymap]] +on = "" +run = "plugin split-tabs spl_switch_tab" +desc = "Dual-pane: switch pane" + +[[mgr.prepend_keymap]] +on = "P" +run = "plugin split-tabs spl_preview" +desc = "Dual-pane: toggle bottom preview" + +[[mgr.prepend_keymap]] +on = "" +run = "shell -- rofi -theme fullscreen-preview -show filebrowser -filebrowser-command \"ya emit reveal\" -filebrowser-directory \"$(pwd)\"" +desc = "Grid view" + +[[mgr.prepend_keymap]] +on = "K" +run = "plugin parent-arrow -1" + +[[mgr.prepend_keymap]] +on = "J" +run = "plugin parent-arrow 1" diff --git a/dot_config/yazi/plugins/parent-arrow.yazi/main.lua b/dot_config/yazi/plugins/parent-arrow.yazi/main.lua new file mode 100644 index 0000000..ffcdc50 --- /dev/null +++ b/dot_config/yazi/plugins/parent-arrow.yazi/main.lua @@ -0,0 +1,12 @@ +--- @sync entry +local function entry(_, job) + local parent = cx.active.parent + if not parent then return end + + local target = parent.files[parent.cursor + 1 + job.args[1]] + if target and target.cha.is_dir then + ya.emit("cd", { target.url }) + end +end + +return { entry = entry }