[mgr]
prepend_keymap = [
  { on = "F", run = "plugin smart-filter", desc = "Smart filter" },
  # rsync plugin
  { on = ["R"], run = "plugin rsync", desc = "Copy files using rsync" },
  # yafg plugin
  { on = ["F", "G"], run = "plugin yafg" },
  # lazygit plugin
  { on = ["g", "i"], run = "plugin lazygit", desc = "run lazygit" },
  # mount plugin
  { on = "M", run = "plugin mount" },
  # smart-enter plugin
  { on = "l", run = "plugin smart-enter", desc = "Enter the child directory, or open the file" },
  # jump-to-char plugin
  { on = "f", run = "plugin jump-to-char", desc = "Jump to char" },
  # whoosh plugin
  { on = "[", run = "plugin whoosh jump_by_key", desc = "Jump bookmark by key" },
  # Direct fuzzy search access
  { on = "}", run = "plugin whoosh jump_by_fzf", desc = "Direct fuzzy search for bookmarks" },
  # Basic bookmark operations
  { on = ["]", "a"], run = "plugin whoosh save", desc = "Add bookmark (hovered file/directory)" },
  { on = ["]", "A"], run = "plugin whoosh save_cwd", desc = "Add bookmark (current directory)" },
  ## Temporary bookmarks
  { on = ["]", "t"], run = "plugin whoosh save_temp", desc = "Add temporary bookmark (hovered file/directory)" },
  { on = ["]", "T"], run = "plugin whoosh save_cwd_temp", desc = "Add temporary bookmark (current directory)" },
  ## Jump to bookmarks
  { on = "<A-k>", run = "plugin whoosh jump_key_k", desc = "Jump directly to bookmark with key k" },
  { on = ["]", "f"], run = "plugin whoosh jump_by_fzf", desc = "Jump bookmark by fzf" },
  ## Delete bookmarks
  { on = ["]", "d"], run = "plugin whoosh delete_by_key", desc = "Delete bookmark by key" },
  { on = ["]", "D"], run = "plugin whoosh delete_by_fzf", desc = "Delete bookmarks by fzf (use TAB to select multiple)" },
  { on = ["]", "C"], run = "plugin whoosh delete_all", desc = "Delete all user bookmarks" },
  ## Rename Bookmarks
  { on = ["]", "r"], run = "plugin whoosh rename_by_key", desc = "Rename bookmark by key" },
  { on = ["]", "R"], run = "plugin whoosh rename_by_fzf", desc = "Rename bookmark by fzf" },
  # Navigation
  { on = ["<Esc>"], run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
  { on = ["q"], run = "quit", desc = "Exit the process" },
  { on = ["<C-q>"], run = "close", desc = "Close the current tab, or quit if it is last tab" },
  # projects plugin
  { on = ["P", "p"], run = "plugin projects 'load SomeProject'", desc = "Load the 'SomeProject' project" },
  { on = ["P", "s"], run = "plugin projects save", desc = "Save current project" },
  { on = ["P", "l"], run = "plugin projects load", desc = "Load project" },
  { on = ["P", "P"], run = "plugin projects load_last", desc = "Load last project" },
  { on = ["P", "d"], run = "plugin projects delete", desc = "Delete project" },
  { on = ["P", "D"], run = "plugin projects delete_all", desc = "Delete all projects" },
  { on = ["P", "m"], run = "plugin projects 'merge current'", desc = "Merge current tab to other projects" },
  { on = ["P", "M"], run = "plugin projects 'merge all'", desc = "Merge current project to other projects" },
  # fazif plugin
  { on = ["b", "d"], run = "plugin fazif faziffd", desc = "Find files/directories with fd and fzf" },
  { on = ["b", "D"], run = "plugin fazif faziffdr", desc = "Find files/directories with fd and fzf" },
  { on = ["b", "r"], run = "plugin fazif fazifrg", desc = "Find content in files with ripgrep and fzf" },
  { on = ["b", "R"], run = "plugin fazif fazifrga", desc = "Find content in documents with ripgrep-all and fzf" },
  # Tagging plugin
  # ─────────────────────────── TOGGLE TAG(S) ────────────────────────────
  { on = ["t", "t", "k"], run = "plugin simple-tag -- toggle-tag", desc = "Toggle a tag (press any key)" },
  { on = ["'"], run = "plugin simple-tag -- toggle-tag --keys=!", desc = "Toggle tag(s) with fixed tag key(s) = (! and 1 and q)" },
  { on = ["-"], run = "plugin simple-tag -- toggle-tag --keys=1", desc = "Toggle tag(s) with fixed tag key(s) = (! and 1 and q)" },
  { on = ["t", "t", "i"], run = "plugin simple-tag -- toggle-tag --input", desc = "Toggle tag(s) with value from (input box)" },
  # ─────────────────────────── ADD TAG(S) ───────────────────────────────
  { on = ["t", "a", "k"], run = "plugin simple-tag -- add-tag", desc = "Add a tag (press any key)" },
  # { on = [ "t", "a", "f" ], run = "plugin simple-tag -- add-tag --keys=!1q", desc = "Add tag(s) with fixed tag keys = (! and 1 and q)" },
  { on = ["t", "a", "i"], run = "plugin simple-tag -- add-tag --input", desc = "Add tag(s) with value from (input box)" },
  # ─────────────────────────── REMOVE/DELETE TAG(S) ───────────────────────────
  { on = ["t", "d", "k"], run = "plugin simple-tag -- remove-tag", desc = "Remove a tag (press any key)" },
  { on = ["t", "d", "f"], run = "plugin simple-tag -- remove-tag --keys=!1q", desc = "Remove tag(s) with fixed tag keys = (! and 1 and q)" },
  { on = ["t", "d", "i"], run = "plugin simple-tag -- remove-tag --input", desc = "Remove tag(s) with value from (input box)" },
  # ─────────────────────────── REPLACE ALL OLD TAG(S) WITH NEW TAG(S) ───────────────────────────
  { on = ["t", "r", "k"], run = "plugin simple-tag -- replace-tag", desc = "Replace with a new tag (press any key)" },
  { on = ["t", "r", "f"], run = "plugin simple-tag -- replace-tag --keys=!1q", desc = "Replace tag(s) with fixed tag keys = (! and 1 and q)" },
  { on = ["t", "r", "i"], run = "plugin simple-tag -- replace-tag --input", desc = "Replace tag(s) with value from (input box)" },
  # ─────────────────────────── EDIT TAG(S) ───────────────────────────
  { on = ["t", "e"], run = "plugin simple-tag -- edit-tag ", desc = "Edit tag(s) (input box)" },
  # ───────────────────────────── CLEAR TAG(S) ─────────────────────────────
  { on = ["t", "c"], run = "plugin simple-tag -- clear", desc = "Clear all tags from selected or hovered files" },
  # ───────────────────────────── CHANGE UI ─────────────────────────────
  { on = ["t", "u", "s"], run = "plugin simple-tag -- toggle-ui", desc = "Toggle tag indicator (icon > tag key > hidden)" },
  { on = ["t", "u", "h"], run = "plugin simple-tag -- toggle-ui --mode=hidden", desc = "Hide all tags indicator" },
  # ─────────────────────── FILTER FILES/FOLDERS BY TAGS: ───────────────────────
  { on = ["t", "f"], run = "plugin simple-tag -- filter", desc = "Filter files/folders by a tag (press any key)" },
  { on = ["t", "F"], run = "plugin simple-tag -- filter --input", desc = "Filter files/folders by tag(s) (input box)" },
  { on = ["t", "F"], run = "plugin simple-tag -- filter --input --mode=or", desc = "Filter files/folders by contain tags (input box)" },
  # ─────────────────────── VISUAL SELECT FILES/FOLDERS BY TAGS: ───────────────────────
  # Available selection actions:
  # replace → Replaces the current selection list with files/folders that have the selected tag.
  # unite → Combines the currently selected files/folders with those that have the selected tag.
  # intersect → Keeps only the files/folders that are present in both the current selection and the tagged items.
  # subtract → Deselects files/folders that have the selected tag from the current selection.
  # exclude → Combines the currently selected files/folders with the tagged items, then deselects any overlapping items between the current selection and the tagged items.
  # undo → Undos or redoes the last selection action.
  { on = ["t", "s", "t"], run = "plugin simple-tag -- toggle-select", desc = "Select a selection action then select a tag key (toggle-select)" },
  { on = ["t", "s", "t"], run = "plugin simple-tag -- toggle-select --keys=!1q", desc = "" },
  { on = ["t", "s", "r"], run = "plugin simple-tag -- replace-select", desc = "replace-select" },
  { on = ["t", "s", "u"], run = "plugin simple-tag -- unite-select", desc = "unite-select" },
  { on = ["t", "s", "i"], run = "plugin simple-tag -- intersect-select", desc = "intersect-select" },
  { on = ["t", "s", "s"], run = "plugin simple-tag -- subtract-select", desc = "subtract-select" },
  { on = ["t", "s", "e"], run = "plugin simple-tag -- exclude-select", desc = "exclude-select" },
  { on = ["t", "s", "e"], run = "plugin simple-tag -- replace-select --keys=!1q", desc = "Replaces the current selection list with files/folders that have (! and 1 and q) tag(s)" },
  { on = ["t", "s", "R"], run = "plugin simple-tag -- replace-select --input", desc = "replace-select --input" },
  { on = ["t", "s", "U"], run = "plugin simple-tag -- unite-select --input", desc = "unite-select --input" },
  { on = ["t", "s", "I"], run = "plugin simple-tag -- intersect-select --input", desc = "intersect-select --input" },
  { on = ["t", "s", "S"], run = "plugin simple-tag -- subtract-select --input", desc = "subtract-select --input" },
  { on = ["t", "s", "E"], run = "plugin simple-tag -- exclude-select --input", desc = "exclude-select --input" },
  { on = ["t", "s", "R"], run = "plugin simple-tag -- replace-select --input --mode=or", desc = "replace-select --input --mode=or" },
  { on = ["t", "s", "R"], run = "plugin simple-tag -- replace-select --keys=!1q --mode=or", desc = "replace-select --keys=!1q --mode=or" },
  # Undo/Redo selection (only works after using 5 modes above)
  { on = ["t", "s", "u"], run = "plugin simple-tag -- undo-select", desc = "Undos/Redos the last selection action" },
  # Directory navigation
  { on = ["k"], run = "arrow -1", desc = "Move cursor up" },
  { on = ["j"], run = "arrow 1", desc = "Move cursor down" },
  { on = ["h"], run = "leave", desc = "Go back to parent directory" },
  { on = ["l"], run = "enter", desc = "Enter directory" },
  # File operations
  { on = ["<Enter>"], run = "open", desc = "Open selected files" },
  { on = ["y"], run = "yank", desc = "Yank selected files (copy)" },
  { on = ["x"], run = "yank --cut", desc = "Yank selected files (cut)" },
  { on = ["p"], run = "paste", desc = "Paste yanked files" },
  { on = ["d"], run = "remove", desc = "Trash selected files" },
  { on = ["D"], run = "remove --permanently", desc = "Permanently delete selected files" },
  { on = ["a"], run = "create", desc = "Create a file or directory" },
  { on = ["r"], run = "rename --cursor=before_ext", desc = "Rename selected file" },
  # Selection
  { on = ["e"], run = ["select --state=none", "arrow 1"], desc = "Toggle selection" },
  { on = ["v"], run = "visual_mode", desc = "Enter visual mode" },
  { on = ["V"], run = "visual_mode --unset", desc = "Enter visual mode (unset)" },
  # Search
  { on = ["/"], run = "find --smart", desc = "Find file" },
  { on = ["n"], run = "find_arrow", desc = "Go to next found" },
  { on = ["N"], run = "find_arrow --previous", desc = "Go to previous found" },
  # Tabs
  { on = ["T"], run = "tab_create --current", desc = "Create new tab" },
  { on = ["1"], run = "tab_switch 0", desc = "Switch to tab 1" },
  { on = ["2"], run = "tab_switch 1", desc = "Switch to tab 2" },
  { on = ["3"], run = "tab_switch 2", desc = "Switch to tab 3" },
  # Preview
  { on = ["z"], run = "plugin --sync hide-preview", desc = "Toggle preview" },
  # Other
  { on = ["g", "h"], run = "cd ~", desc = "Go to home directory" },
  { on = ["g", "c"], run = "cd ~/.config", desc = "Go to config directory" },
  { on = ["g", "d"], run = "cd ~/Downloads", desc = "Go to downloads" },
  { on = ["~"], run = "help", desc = "Open help" },
]

[tasks]
prepend_keymap = [
  { on = ["<Esc>"], run = "close", desc = "Close task manager" },
  { on = ["k"], run = "arrow -1", desc = "Move cursor up" },
  { on = ["j"], run = "arrow 1", desc = "Move cursor down" },
]

[select]
prepend_keymap = [
  { on = ["<Esc>"], run = "close", desc = "Cancel selection" },
  { on = ["<Enter>"], run = "close --submit", desc = "Submit selection" },
  { on = ["k"], run = "arrow -1", desc = "Move cursor up" },
  { on = ["j"], run = "arrow 1", desc = "Move cursor down" },
]

[input]
prepend_keymap = [
  { on = ["<Esc>"], run = "close", desc = "Cancel input" },
  { on = ["<Enter>"], run = "close --submit", desc = "Submit input" },
]

[completion]
prepend_keymap = [
  { on = ["<Tab>"], run = "close --submit", desc = "Submit completion" },
  { on = ["k"], run = "arrow -1", desc = "Move cursor up" },
  { on = ["j"], run = "arrow 1", desc = "Move cursor down" },
]

[help]
prepend_keymap = [
  { on = ["<Esc>"], run = "escape", desc = "Clear filter or exit help" },
  { on = ["q"], run = "close", desc = "Exit help" },
  { on = ["k"], run = "arrow -1", desc = "Move cursor up" },
  { on = ["j"], run = "arrow 1", desc = "Move cursor down" },
]
