command line editing

Ctrl key Description Vim Alt Key Description Vim
Ctrl-A Move to BOL ^  
Ctrl-E Move to EOL $  
Ctrl-F Move to one char Right l Alt-F Move to one word Right w
Ctrl-B Move to one char Left h Alt-B Move to one word Left b
Ctrl-D Del current char (DEL) x Alt-D Del from current char till word end de
Ctrl-H Backspace        
Ctrl-U Cut (In Buf) till BOL d0 Alt-U Uppercase current word veU
Ctrl-L Clear   Alt-L Lowercase current word veu
      Alt-C Uppercase current char, move to word end vUe
Ctrl-K Cut (In Buf) till EOL D  
Ctrl-W Cut (In Buf) till word beginning db  
Ctrl-Y Paste buffer value (by cut)    
Ctrl-_ Undo last change C-_ works too    
Ctrl-T Swap current and previous char xp Alt-T swap current and previous words  
C-@ and C-x C-x C-@ set marker and C-x C-x to swap current pos with the mark    

E.g. Alt-3 Alt-B go to 3 words backwards same as in vim 3b

Except for the above table, there are still other useful short-cuts:

E.g

Zsh config for command line editing

Ctrl-X Ctrl-E

ctrl-x ctrl-e open $EDITOR to edit the current commandline. In Zsh:

#edit command in vi ctrl-x ctrl-e
autoload edit-command-line
zle -N edit-command-line
bindkey '^X^e' edit-command-line

find next/pre char

similar as f/F in vim:

#ctrl-] to search next char in command line same as 'f' in vim
bindkey '^]' vi-find-next-char
#alt-] to search previous char in command line same as 'F' in vim
bindkey '\e]' vi-find-prev-char

Other Zsh keybinds

<<Back