Files
dotfiles/config/yazi/keymap.toml
2025-10-19 00:14:19 +02:00

547 lines
17 KiB
TOML
Executable File

# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config0
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas.
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json"
[mgr]
prepend_keymap = [
{ on = "l", run = 'plugin smart-enter' },
{ on = "<Enter>", run = 'plugin smart-enter' },
{ on = "S", run = 'shell "$SHELL" --block --confirm' },
{ on = [
"#",
"a",
], run = "plugin yamb save", desc = "Add bookmark" },
{ on = [
"#",
"#",
], run = "plugin yamb jump_by_fzf", desc = "Jump bookmark by fzf" },
{ on = [
"#",
"r",
], run = "plugin yamb delete_by_key", desc = "Delete bookmark by key" },
{ on = [
"P",
], run = "spot", desc = "Open spotter" },
{ on = [
"c",
"a",
], run = "plugin compress", desc = "Archive selected files" },
]
keymap = [
{ on = "<Esc>", run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
{ on = "<C-[>", run = "escape", desc = "Exit visual mode, clear selected, or cancel search" },
#{ on = "q", run = "quit", desc = "Exit the process" },
{ on = "q", run = "close", desc = "Close the current tab, or quit if it is last tab" },
{ on = "Q", run = "quit --no-cwd-file", desc = "Exit the process without writing cwd-file" },
{ on = "<C-z>", run = "suspend", desc = "Suspend the process" },
{ on = "R", run = "reload", desc = "Refresh the current directory" },
# Hopping
{ on = "k", run = "arrow -1", desc = "Move cursor up" },
{ on = "j", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
{ on = "<C-k>", run = "arrow -50%", desc = "Move cursor up half page" },
{ on = "<C-j>", run = "arrow 50%", desc = "Move cursor down half page" },
{ on = "K", run = "arrow -5", desc = "Move cursor up 5 rows" },
{ on = "J", run = "arrow 5", desc = "Move cursor down 5 rows" },
{ on = "<S-PageUp>", run = "arrow -50%", desc = "Move cursor up half page" },
{ on = "<S-PageDown>", run = "arrow 50%", desc = "Move cursor down half page" },
{ on = "<PageUp>", run = "arrow -100%", desc = "Move cursor up one page" },
{ on = "<PageDown>", run = "arrow 100%", desc = "Move cursor down one page" },
{ on = [
"g",
"g",
], run = "arrow bot", desc = "Move cursor to the top" },
{ on = "G", run = "arrow top", desc = "Move cursor to the bottom" },
# Navigation
{ on = "h", run = "leave", desc = "Go back to the parent directory" },
{ on = "<Left>", run = "leave", desc = "Go back to the parent directory" },
{ on = "<Right>", run = "enter", desc = "Enter the child directory" },
{ on = "N", run = "back", desc = "Go back to the previous directory" },
{ on = "I", run = "forward", desc = "Go forward to the next directory" },
# Selection
{ on = "<Space>", run = [
"toggle",
"arrow 1",
], desc = "Toggle the current selection state" },
{ on = "v", run = "toggle_all", desc = "Enter visual mode (selection mode)" },
{ on = "V", run = "visual_mode --unset", desc = "Enter visual mode (unset mode)" },
# { on = "<C-a>", run = "select_all --state=true", desc = "Select all files" },
# { on = "<C-r>", run = "select_all --state=none", desc = "Inverse selection of all files" },
# Find
{ on = "<C-p>", run = "plugin fzf", desc = "Jump to a directory or reveal a file using fzf" },
{ on = [
"z",
"o",
], run = "plugin zoxide", desc = "Jump to a directory using zoxide" },
# { on = "f", run = "search fd", desc = "Search files by name using fd" },
{ on = "F", run = "search rg", desc = "Search files by content using ripgrep" },
{ on = "<C-s>", run = "escape --search", desc = "Cancel the ongoing search" },
{ on = "f", run = "filter --smart", desc = "Filter files" },
{ on = "/", run = "find --smart", desc = "Find next file" },
{ on = "?", run = "find --previous --smart", desc = "Find previous file" },
{ on = "n", run = "find_arrow", desc = "Go to the next found" },
{ on = "N", run = "find_arrow --previous", desc = "Go to the previous found" },
# Shell
{ on = "<C-g>", run = "shell --confirm --block lazygit", desc = "Lazygit" },
{ on = ";", run = "shell --interactive", desc = "Run a shell command" },
{ on = ":", run = "shell --block --interactive", desc = "Run a shell command (block until finishes)" },
# Hidden files
{ on = ".", run = "hidden toggle", desc = "Toggle the visibility of hidden files" },
# Open
{ on = "r", run = "open --interactive", desc = "Open selected files interactively" },
# Create
{ on = "T", run = "create", desc = "Create a file (ends with / for directories)" },
{ on = "M", run = "create --dir", desc = "Create a directory" },
# Rename
{ on = [
"c",
"w",
], run = "rename --empty=all", desc = "Rename selected file(s)" },
{ on = "k", run = "rename --cursor=start", desc = "Rename selected file(s)" },
{ on = "a", run = "rename --cursor=before_ext", desc = "Rename selected file(s)" },
{ on = "A", run = "rename --cursor=end", desc = "Rename selected file(s)" },
# Operation: D
{ on = [
"d",
"d",
], run = "yank --cut", desc = "Yank selected files (cut)" },
# { on = ["d"], run = "remove", desc = "Trash selected files" },
{ on = [
"d",
"D",
], run = "remove --permanently", desc = "Permanently delete selected files" },
# Operation: Y
{ on = [
"y",
"y",
], run = "yank", desc = "Yank selected files (copy)" },
{ on = [
"y",
"p",
], run = "copy path", desc = "Copy the file path" },
{ on = [
"y",
"d",
], run = "copy dirname", desc = "Copy the directory path" },
{ on = [
"y",
"f",
], run = "copy filename", desc = "Copy the filename" },
{ on = [
"y",
"n",
], run = "copy name_without_ext", desc = "Copy the filename without extension" },
{ on = [
"y",
"c",
], run = "unyank", desc = "Cancel the yank status" },
# Operation: P
{ on = [
"p",
"p",
], run = "paste", desc = "Paste yanked files" },
{ on = [
"p",
"P",
], run = "paste --force", desc = "Paste yanked files (overwrite if the destination exists)" },
{ on = [
"p",
"l",
], run = "link", desc = "Symlink the absolute path of yanked files" },
{ on = [
"p",
"L",
], run = "link --relative", desc = "Symlink the relative path of yanked files" },
{ on = [
"p",
"h",
], run = "hardlink", desc = "Hardlink yanked files" },
# Linemode
{ on = [
"m",
"s",
], run = "linemode size", desc = "Set linemode to size" },
{ on = [
"m",
"p",
], run = "linemode perm", desc = "Set linemode to permissions" },
{ on = [
"m",
"c",
], run = "linemode btime", desc = "Set linemode to btime" },
{ on = [
"m",
"m",
], run = "linemode mtime", desc = "Set linemode to mtime" },
{ on = [
"m",
"o",
], run = "linemode owner", desc = "Set linemode to owner" },
{ on = [
"m",
"n",
], run = "linemode none", desc = "Set linemode to none" },
# Sorting
{ on = [
"o",
"M",
], run = [
"sort mtime --reverse=no",
"linemode mtime",
], desc = "Sort by modified time" },
{ on = [
"o",
"m",
], run = [
"sort mtime --reverse",
"linemode mtime",
], desc = "Sort by modified time (reverse)" },
{ on = [
"o",
"C",
], run = [
"sort btime --reverse=no",
"linemode btime",
], desc = "Sort by created time" },
{ on = [
"o",
"c",
], run = [
"sort btime --reverse",
"linemode btime",
], desc = "Sort by created time (reverse)" },
{ on = [
"o",
"E",
], run = "sort extension --reverse=no", desc = "Sort by extension" },
{ on = [
"o",
"e",
], run = "sort extension --reverse", desc = "Sort by extension (reverse)" },
{ on = [
"o",
"a",
], run = "sort alphabetical --reverse=no", desc = "Sort alphabetically" },
{ on = [
"o",
"A",
], run = "sort alphabetical --reverse", desc = "Sort alphabetically (reverse)" },
{ on = [
"o",
"n",
], run = "sort natural --reverse=no", desc = "Sort naturally" },
{ on = [
"o",
"N",
], run = "sort natural --reverse", desc = "Sort naturally (reverse)" },
{ on = [
"o",
"s",
], run = [
"sort size --reverse=no",
"linemode size",
], desc = "Sort by size" },
{ on = [
"o",
"S",
], run = [
"sort size --reverse",
"linemode size",
], desc = "Sort by size (reverse)" },
# Goto
{ on = [
"g",
"r",
], run = "cd /", desc = "Go to the root directory" },
{ on = [
"g",
"h",
], run = "cd ~", desc = "Go to the home directory" },
{ on = [
"g",
"c",
], run = "cd ~/.config", desc = "Go to the config directory" },
{ on = [
"g",
"d",
], run = "cd ~/Downloads", desc = "Go to the downloads directory" },
{ on = [
"g",
"D",
], run = "cd ~/Desktop", desc = "Go to the desktop directory" },
{ on = [
"g",
"i",
], run = "cd ~/Github", desc = "Go to the Github directory" },
{ on = [
"g",
"f",
"f",
], run = "cd ~/.config" },
{ on = [
"g",
"f",
"n",
], run = "cd ~/.config/nvim" },
{ on = [
"g",
"f",
"y",
], run = "cd ~/.config/yazi" },
{ on = [
"g",
"f",
"l",
], run = "cd ~/.config/jesseduffield/lazygit" },
{ on = [
"g",
"<Space>",
], run = "cd --interactive", desc = "Go to a directory interactively" },
# Tabs
{ on = [
"t",
"u",
], run = "tab_create --current", desc = "Create a new tab with CWD" },
{ on = [
"t",
"n",
], run = "tab_switch -1 --relative", desc = "Switch to the previous tab" },
{ on = [
"t",
"i",
], run = "tab_switch 1 --relative", desc = "Switch to the next tab" },
#{ on = ["t", ""], run = "tab_swap -1", desc = "Swap current tab with previous tab" },
#{ on = ["}"], run = "tab_swap 1", desc = "Swap current tab with next tab" },
{ on = "1", run = "tab_switch 0", desc = "Switch to the first tab" },
{ on = "2", run = "tab_switch 1", desc = "Switch to the second tab" },
{ on = "3", run = "tab_switch 2", desc = "Switch to the third tab" },
{ on = "4", run = "tab_switch 3", desc = "Switch to the fourth tab" },
{ on = "5", run = "tab_switch 4", desc = "Switch to the fifth tab" },
{ on = "6", run = "tab_switch 5", desc = "Switch to the sixth tab" },
{ on = "7", run = "tab_switch 6", desc = "Switch to the seventh tab" },
{ on = "8", run = "tab_switch 7", desc = "Switch to the eighth tab" },
{ on = "9", run = "tab_switch 8", desc = "Switch to the ninth tab" },
# Tasks
{ on = "w", run = "tasks_show", desc = "Show task manager" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[spot]
keymap = [
# Navigation
{ on = "u", run = "arrow -1", desc = "Move up" },
{ on = "e", run = "arrow 1", desc = "Move down" },
# Close
{ on = "<Esc>", run = "close", desc = "Close spotter" },
{ on = "q", run = "close", desc = "Close spotter" },
# Swipe through files
{ on = "<C-u>", run = "swipe -5", desc = "Swipe 5 files up" },
{ on = "<C-e>", run = "swipe 5", desc = "Swipe 5 files down" },
# Copy content
{ on = "y", run = "copy cell", desc = "Copy cell content" },
]
[tasks]
keymap = [
{ on = "<Esc>", run = "close", desc = "Close task manager" },
{ on = "<C-[>", run = "close", desc = "Close task manager" },
{ on = "<C-c>", run = "close", desc = "Close task manager" },
{ on = "w", run = "close", desc = "Close task manager" },
{ on = "u", run = "arrow -1", desc = "Move cursor up" },
{ on = "e", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Enter>", run = "inspect", desc = "Inspect the task" },
{ on = "x", run = "cancel", desc = "Cancel the task" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[pick]
keymap = [
{ on = "<Esc>", run = "close", desc = "Cancel selection" },
{ on = "<C-[>", run = "close", desc = "Cancel selection" },
{ on = "<C-c>", run = "close", desc = "Cancel selection" },
{ on = "<Enter>", run = "close --submit", desc = "Submit the selection" },
{ on = "u", run = "arrow -1", desc = "Move cursor up" },
{ on = "e", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[input]
keymap = [
{ on = "<C-c>", run = "close", desc = "Cancel input" },
{ on = "<Enter>", run = "close --submit", desc = "Submit the input" },
{ on = "<Esc>", run = "escape", desc = "Go back the normal mode, or cancel input" },
{ on = "<C-[>", run = "escape", desc = "Go back the normal mode, or cancel input" },
# Mode
{ on = "k", run = "insert", desc = "Enter insert mode" },
{ on = "a", run = "insert --append", desc = "Enter append mode" },
{ on = "K", run = [
"move -999",
"insert",
], desc = "Move to the BOL, and enter insert mode" },
{ on = "A", run = [
"move 999",
"insert --append",
], desc = "Move to the EOL, and enter append mode" },
{ on = "v", run = "visual", desc = "Enter visual mode" },
{ on = "V", run = [
"move -999",
"visual",
"move 999",
], desc = "Enter visual mode and select all" },
# Character-wise movement
{ on = "n", run = "move -1", desc = "Move back a character" },
{ on = "i", run = "move 1", desc = "Move forward a character" },
{ on = "<Left>", run = "move -1", desc = "Move back a character" },
{ on = "<Right>", run = "move 1", desc = "Move forward a character" },
{ on = "<C-b>", run = "move -1", desc = "Move back a character" },
{ on = "<C-f>", run = "move 1", desc = "Move forward a character" },
# Word-wise movement
{ on = "b", run = "backward", desc = "Move back to the start of the current or previous word" },
{ on = "w", run = "forward", desc = "Move forward to the start of the next word" },
{ on = "h", run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
{ on = "<A-b>", run = "backward", desc = "Move back to the start of the current or previous word" },
{ on = "<A-f>", run = "forward --end-of-word", desc = "Move forward to the end of the current or next word" },
# Line-wise movement
{ on = "N", run = "move -999", desc = "Move to the BOL" },
{ on = "I", run = "move 999", desc = "Move to the EOL" },
{ on = "<C-a>", run = "move -999", desc = "Move to the BOL" },
{ on = "<C-e>", run = "move 999", desc = "Move to the EOL" },
{ on = "<Home>", run = "move -999", desc = "Move to the BOL" },
{ on = "<End>", run = "move 999", desc = "Move to the EOL" },
# Delete
{ on = "<Backspace>", run = "backspace", desc = "Delete the character before the cursor" },
{ on = "<Delete>", run = "backspace --under", desc = "Delete the character under the cursor" },
{ on = "<C-h>", run = "backspace", desc = "Delete the character before the cursor" },
{ on = "<C-d>", run = "backspace --under", desc = "Delete the character under the cursor" },
# Kill
{ on = "<C-u>", run = "kill bol", desc = "Kill backwards to the BOL" },
{ on = "<C-k>", run = "kill eol", desc = "Kill forwards to the EOL" },
{ on = "<C-w>", run = "kill backward", desc = "Kill backwards to the start of the current word" },
{ on = "<A-d>", run = "kill forward", desc = "Kill forwards to the end of the current word" },
# Cut/Yank/Paste
{ on = "d", run = "delete --cut", desc = "Cut the selected characters" },
{ on = "D", run = [
"delete --cut",
"move 999",
], desc = "Cut until the EOL" },
{ on = "c", run = "delete --cut --insert", desc = "Cut the selected characters, and enter insert mode" },
{ on = "C", run = [
"delete --cut --insert",
"move 999",
], desc = "Cut until the EOL, and enter insert mode" },
{ on = "x", run = [
"delete --cut",
"move 1 --in-operating",
], desc = "Cut the current character" },
{ on = "y", run = "yank", desc = "Copy the selected characters" },
{ on = "p", run = "paste", desc = "Paste the copied characters after the cursor" },
{ on = "P", run = "paste --before", desc = "Paste the copied characters before the cursor" },
# Undo/Redo
{ on = "l", run = "undo", desc = "Undo the last operation" },
{ on = "<C-r>", run = "redo", desc = "Redo the last operation" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[completion]
keymap = [
{ on = "<C-c>", run = "close", desc = "Cancel completion" },
{ on = "<Tab>", run = "close --submit", desc = "Submit the completion" },
{ on = "<Enter>", run = [
"close --submit",
"close_input --submit",
], desc = "Submit the completion and input" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
{ on = "<C-u>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<C-e>", run = "arrow 1", desc = "Move cursor down" },
# Help
{ on = "~", run = "help", desc = "Open help" },
{ on = "<F1>", run = "help", desc = "Open help" },
]
[help]
keymap = [
{ on = "<Esc>", run = "escape", desc = "Clear the filter, or hide the help" },
{ on = "<C-[>", run = "escape", desc = "Clear the filter, or hide the help" },
{ on = "q", run = "close", desc = "Exit the process" },
{ on = "<C-c>", run = "close", desc = "Hide the help" },
# Navigation
{ on = "u", run = "arrow -1", desc = "Move cursor up" },
{ on = "e", run = "arrow 1", desc = "Move cursor down" },
{ on = "<Up>", run = "arrow -1", desc = "Move cursor up" },
{ on = "<Down>", run = "arrow 1", desc = "Move cursor down" },
# Filtering
{ on = "f", run = "filter", desc = "Apply a filter for the help items" },
]