CTRL + A
: Move the cursor to the beginning of the line
CTRL + E
: Move the cursor to the end of the line
OPTION + Left Arrow
: Move the cursor one word backward
OPTION + Right arrow
: Move the cursor one word forward
Left Arrow
: Move the cursor one character backward
Right Arrow
: Move the cursor one character forward
CTRL + U
: Delete the current line
CTRL + K
: Delete from the cursor to the end of the line
ESC + Backspace
: Delete one word backward
CTRL + W
: Delete one word backward
CTRL + D
: Delete one character forward
Fn + Backspace
: Delete one character forward
Backspace
: Delete one character backward
CTRL + L
: Clear the screen
CTRL + _
: Undo the last change
CTRL + C
: Terminate the running foreground process
CTRL + Z
: Suspend the running foreground process
CTRL + D
: Exit current shell
Up Arrow
: Recall the previous command in history
Down Arrow
: Recall the next command in history
CTRL + R
: Search the command history
CTRL + G
: Escape from command search mode
!!
: Execute the last typed command
!pw
: Execute the last command in history that begins with pw
TAB
: Auto-complete the typed command
TAB TAB
: Show list of commands
TAB TAB TAB ...
: Cycle through matched commands
% bindkey
None of these work for me by default. Tried on both Terminal.app and VS Code's builtin terminal.
OPTION + Left Arrow
does move the cursor back one word, but it puts it in some edit mode such that if I subsequently press the right arrow key it will delete everything after the cursor (other keys do strange things in this mode as well, for example, pressinge
in this mode will jump to either the end of the line or the end of the character).OPTION + Right Arrow
doesn't move the cursor and puts zsh into the weird mode. Bash works properly on both terminal emulators. I have not added any keybindings.CTRL + A
just drops^A
characters into the terminal.When I run
cat
and then doOption + Left Arrow
followed byOption + Right Arrow
it prints^[b^[f
.