In zsh Option + Backspace deletes the whole path on a prompt. For example:

ls /usr/local/bin

Option + Backspace returns:


How can I set the same behavior so that the shortcut deletes just one word, till the next delimiter, like:

ls /usr/local/bin

Option + Backspace should return:

ls /usr/local/
  • This seems to be related how zsh treats a word. Not sure how to change the behavior yet. If anyone knows please let me know. Thank you. Commented Feb 14, 2020 at 21:22

1 Answer 1


An arbitrary number of alphabetic characters and digits as well as chars defined by WORDCHARS are considered all one word in zsh.

The default value of WORDCHARS is:


By defining another/a new WORDCHARS in .zprofile (and/or .zshrc|... - depends on how you configured your zsh environment), you can modify the behaviour of werase (word erase - usually ctrl/^w).

Simply add the line export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>' in .zprofile|..., close the Terminal window or source .zprofile|... and werase works as you want afterwards.

Keep in mind that other shortcuts (like alt/⌥) will also be affected then.

If you want a different behaviour, check this question & answer: zsh: using different WORDCHARS for kill-word and forward-word / backward-word

  • That's exactly what I end up doing but forgot to answer my question. Thank you. Commented Feb 16, 2020 at 14:46
  • Is there a means to view and alter $WORDCHARS for the entire OS?
    – kando
    Commented Apr 16 at 18:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .