yazi/config/preset/keymap.toml
2023-08-03 18:55:40 +08:00

177 lines
5.2 KiB
TOML

[manager]
keymap = [
{ on = [ "<Esc>" ], exec = "escape" },
{ on = [ "q" ], exec = "quit" },
{ on = [ "<C-q>" ], exec = "close" },
# Navigation
{ on = [ "k" ], exec = "arrow -1" },
{ on = [ "j" ], exec = "arrow 1" },
{ on = [ "K" ], exec = "arrow -5" },
{ on = [ "J" ], exec = "arrow 5" },
{ on = [ "h" ], exec = "leave" },
{ on = [ "l" ], exec = "enter" },
{ on = [ "H" ], exec = "back" },
{ on = [ "L" ], exec = "forward" },
{ on = [ "<Up>" ], exec = "arrow -1" },
{ on = [ "<Down>" ], exec = "arrow 1" },
{ on = [ "<Left>" ], exec = "leave" },
{ on = [ "<Right>" ], exec = "enter" },
# Selection
{ on = [ "<Space>" ], exec = [ "select --state=none", "arrow 1" ] },
{ on = [ "v" ], exec = "visual_mode" },
{ on = [ "V" ], exec = "visual_mode --unset" },
{ on = [ "<C-a>" ], exec = "select_all --state=true" },
{ on = [ "<C-r>" ], exec = "select_all --state=none" },
# Operation
{ on = [ "o" ], exec = "open" },
{ on = [ "O" ], exec = "open --interactive" },
{ on = [ "<Enter>" ], exec = "open" },
{ on = [ "<C-Enter>" ], exec = "open --interactive" }, # It's cool if you're using a terminal that supports CSI u
{ on = [ "y" ], exec = "yank" },
{ on = [ "x" ], exec = "yank --cut" },
{ on = [ "p" ], exec = "paste" },
{ on = [ "P" ], exec = "paste --force" },
{ on = [ "k" ], exec = "paste --follow" },
{ on = [ "K" ], exec = "paste --follow --force" },
{ on = [ "d" ], exec = "remove" },
{ on = [ "D" ], exec = "remove --permanently" },
{ on = [ "a" ], exec = "create" },
{ on = [ "r" ], exec = "rename" },
{ on = [ "." ], exec = "hidden toggle" },
{ on = [ "s" ], exec = "search fd" },
{ on = [ "S" ], exec = "search rg" },
{ on = [ "<C-s>" ], exec = "search none" },
{ on = [ "z" ], exec = "jump zoxide" },
{ on = [ "Z" ], exec = "jump fzf" },
# Copy
{ on = [ "c", "c" ], exec = "copy path" },
{ on = [ "c", "d" ], exec = "copy dirname" },
{ on = [ "c", "f" ], exec = "copy filename" },
{ on = [ "c", "n" ], exec = "copy name_without_ext" },
# Sorting
{ on = [ ",", "a" ], exec = "sort alphabetical" },
{ on = [ ",", "A" ], exec = "sort alphabetical --reverse" },
{ on = [ ",", "c" ], exec = "sort created --reverse" },
{ on = [ ",", "C" ], exec = "sort created" },
{ on = [ ",", "m" ], exec = "sort modified --reverse" },
{ on = [ ",", "M" ], exec = "sort modified" },
{ on = [ ",", "s" ], exec = "sort size --reverse" },
{ on = [ ",", "S" ], exec = "sort size" },
# Tabs
{ on = [ "t" ], exec = "tab_create --current" },
{ on = [ "1" ], exec = "tab_switch 0" },
{ on = [ "2" ], exec = "tab_switch 1" },
{ on = [ "3" ], exec = "tab_switch 2" },
{ on = [ "4" ], exec = "tab_switch 3" },
{ on = [ "5" ], exec = "tab_switch 4" },
{ on = [ "6" ], exec = "tab_switch 5" },
{ on = [ "7" ], exec = "tab_switch 6" },
{ on = [ "8" ], exec = "tab_switch 7" },
{ on = [ "9" ], exec = "tab_switch 8" },
{ on = [ "[" ], exec = "tab_switch -1 --relative" },
{ on = [ "]" ], exec = "tab_switch 1 --relative" },
{ on = [ "{" ], exec = "tab_swap -1" },
{ on = [ "}" ], exec = "tab_swap 1" },
# Tasks
{ on = [ "w" ], exec = "tasks_show" },
# Goto
{ on = [ "g", "h" ], exec = "cd ~" },
{ on = [ "g", "c" ], exec = "cd ~/.config" },
{ on = [ "g", "d" ], exec = "cd ~/Downloads" },
{ on = [ "g", "t" ], exec = "cd /tmp" },
]
[tasks]
keymap = [
{ on = [ "<C-q>" ], exec = "close" },
{ on = [ "<Esc>" ], exec = "close" },
{ on = [ "w" ], exec = "close" },
{ on = [ "k" ], exec = "arrow -1" },
{ on = [ "j" ], exec = "arrow 1" },
{ on = [ "<Up>" ], exec = "arrow -1" },
{ on = [ "<Down>" ], exec = "arrow 1" },
{ on = [ "<Enter>" ], exec = "inspect" },
{ on = [ "x" ], exec = "cancel" },
]
[select]
keymap = [
{ on = [ "<C-q>" ], exec = "close" },
{ on = [ "<Esc>" ], exec = "close" },
{ on = [ "<Enter>" ], exec = "close --submit" },
{ on = [ "k" ], exec = "arrow -1" },
{ on = [ "j" ], exec = "arrow 1" },
{ on = [ "K" ], exec = "arrow -5" },
{ on = [ "J" ], exec = "arrow 5" },
{ on = [ "<Up>" ], exec = "arrow -1" },
{ on = [ "<Down>" ], exec = "arrow 1" },
]
[input]
keymap = [
{ on = [ "<C-q>" ], exec = "close" },
{ on = [ "<Enter>" ], exec = "close --submit" },
{ on = [ "<Esc>" ], exec = "escape" },
{ on = [ "<Backspace>" ], exec = "backspace" },
# Mode
{ on = [ "i" ], exec = "insert" },
{ on = [ "a" ], exec = "insert --append" },
{ on = [ "v" ], exec = "visual" },
# Navigation
{ on = [ "h" ], exec = "move -1" },
{ on = [ "l" ], exec = "move 1" },
{ on = [ "0" ], exec = "move -999" },
{ on = [ "$" ], exec = "move 999" },
{ on = [ "I" ], exec = [ "move -999", "insert" ] },
{ on = [ "A" ], exec = [ "move 999", "insert --append" ] },
{ on = [ "<Left>" ], exec = "move -1" },
{ on = [ "<Right>" ], exec = "move 1" },
{ on = [ "b" ], exec = "backward" },
{ on = [ "w" ], exec = "forward" },
{ on = [ "e" ], exec = "forward --end-of-word" },
# Deletion
{ on = [ "d" ], exec = "delete --cut" },
{ on = [ "c" ], exec = "delete --cut --insert" },
{ on = [ "x" ], exec = [ "delete --cut", "move 1 --in-operating" ] },
# Yank/Paste
{ on = [ "y" ], exec = [ "yank" ] },
{ on = [ "p" ], exec = [ "paste" ] },
{ on = [ "P" ], exec = [ "paste --before" ] },
# Undo/Redo
{ on = [ "u" ], exec = [ "undo" ] },
{ on = [ "<C-r>" ], exec = [ "redo" ] },
]