August Feng

forward word in zsh

About

In Emacs, the M-f key sequence is bound to forward-word moves the cursor to the end of the current word.

In Zsh, the M-f key sequence is also bound to forward-word, but it moves the cursor to the beginning of the next word.

Preferences

I've been allowing this inconsistency for far too long when Zsh provides a standard widget that implements the same behaviour as Emacs: emacs-forward-word.

Let's just rebind it now:

  bindkey "^[f" emacs-forward-word