Zsh Line Editor Shortcuts

Add a comment

cheat-sheet articles are about code snippets that I need every once in a while, and which I constantly forget about.

Note: These shortcuts are valid for Zsh’s emacs mode, not necessarily for vi mode.

Shortcut Description
M-. insert the last word from the previous history entry1
C-u kill the current line
C-v C-j insert newline at current cursor position
C-x C-e edit current command line in $EDITOR
C-x C-f char move to the next occurrence of character char

  1. press M-. repeatedly to get the last words from older history entries