-
Notifications
You must be signed in to change notification settings - Fork 4
Keymaps
The keymap builtin allows you to register custom key mappings for the line editor. Here is an example:
keymap -n '<Space>y' '"+yy'This command will bind the sequence <Space>y to execute the sequence "+yy, which copies the current line to the clipboard.
The -n flag indicates that this mapping is for normal mode. You can also use -i for insert mode, and -v for visual mode.
Keymaps use vim-style notation for control keys. For example, <C-a> represents Ctrl + a, and <C-Space> represents Ctrl + Space. You can also use <Esc> to represent the escape key. Note that some combinations may behave strangely under certain terminals. For best results, use a terminal that supports the kitty keyboard protocol.
The <CMD> sequence allows you to execute ex mode commands in your sequence. You use it the same way you use : to enter ex mode from normal mode, e.g. <CMD>stash pop. Notably, this can also be used to run arbitrary shell commands as well, like <CMD>!some_command