"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"

[manager]
prepend_keymap = [
  # Navigation
  { on = "e", run = "arrow -1", desc = "Move cursor up" },
  { on = "n", run = "arrow 1", desc = "Move cursor down" },
  { on = "m", run = "leave", desc = "Go back to the parent directory" },
  { on = "i", run = "enter", desc = "Enter the child directory" },
  # Find
  { on = "j", run = "find_arrow", desc = "Goto the next found" },
  { on = "J", run = "find_arrow --previous", desc = "Goto the previous found" },
  # Linemode
  { on = [
    "k",
    "s",
  ], run = "linemode size", desc = "Linemode: size" },
  { on = [
    "k",
    "p",
  ], run = "linemode permissions", desc = "Linemode: permissions" },
  { on = [
    "k",
    "b",
  ], run = "linemode btime", desc = "Linemode: btime" },
  { on = [
    "k",
    "k",
  ], run = "linemode mtime", desc = "Linemode: mtime" },
  { on = [
    "k",
    "o",
  ], run = "linemode owner", desc = "Linemode: owner" },
  { on = [
    "k",
    "n",
  ], run = "linemode none", desc = "Linemode: none" },
  { on = "!", run = 'shell "$SHELL" --block', desc = "Open shell here" },
  # { on = "!", run = 'shell --block --interactive', desc = "Open shell here" },
  { on = [
    "<space>",
    "d",
  ], run = 'shell -- dragon-drop -x -i -T "$1"', desc = "Drag and drop selection" },
  { on = [
    "g",
    "r",
  ], run = 'shell -- ya emit cd "$(git rev-parse --show-toplevel)"', desc = "Goto git root" },
  { on = "o", run = "plugin open-with-cmd --ags=block", desc = "Open with command in terminal" },
  { on = "O", run = "plugin open-with-cmd", desc = "Open with command" },
  { on = [
    "'",
    ";",
  ], run = 'plugin custom-shell -- auto --interactive', desc = "custom-shell as default, interactive" },
  { on = [
    "'",
    ":",
  ], run = 'plugin custom-shell -- auto --interactive --block', desc = "custom-shell as default, interactive, block" },
  { on = "h", run = 'shell --block "helix ."' },
  { on = [
    "C",
  ], run = "plugin ouch zip", desc = "Compress with ouch" },
  { on = [
    "g",
    "i",
  ], run = "plugin lazygit", desc = "run lazygit" },
  { on = [
    "c",
    "C",
  ], run = [
    "plugin copy-file-contents",
  ], desc = "Copy contents of file" },
  { on = [
    "c",
    "m",
  ], run = 'shell -- for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list', desc = "Mime copy" },
  { on = [
    "c",
    "r",
  ], run = "plugin path-from-root", desc = "Copies path from git root" },

]
[input]
prepend_keymap = [
  { on = "l", run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
  { on = "L", run = "forward --far --end-of-word", desc = "Move forward to the end of the current or next WORD" },
  { on = "h", run = "insert", desc = "Enter insert mode" },
  { on = "H", run = [
    "move first-char",
    "insert",
  ], desc = "Move to the BOL, and enter insert mode" },
]
