macOS: zsh option delete changes

I just upgraded to macOS 10.15 and have decided to try to use zshell instead of bash. Figured, why not...

Well, it's going OK for now, but there's one thing that's really getting to me. I have enabled the preference to have the Option key act as the meta key and have really gotten used to being able to use "Option-Delete" to effectively remove one word at a time (ok, it's not specifically one-word, but it usually works to only remove say the last directory name when typing in a full path)

Since switching to zsh, I've noticed that the same command deletes the entire line, up to the first space. If I'm trying to type a full path, like /Users/username/Desktop/Folder1/Folder2, but mistype Folder2 and wanted to just start over, I would normally use option-delete to just delete the word Folder2; in bash, this works fine, but now with zsh it deletes the whole path.

Is there a way to alter this behavior in zshell? So far this is the only thing that has been a bother so far.


In addition to alphanumeric characters, Zsh considers all characters in $WORDCHARS to be part of a word. By default, $WORDCHARS is equal to *?_-.[]~=/&;!#$%^(){}<>. As you can see, this includes /.

By adding

WORDCHARS=''

to your ~/.zshrc file, you can get the behavior you want.

Shameless Plug

Because I, too, think that Zsh's default word editing behavior is subpar, I wrote a plugin to improve it even further: https://github.com/marlonrichert/zsh-edit

Feel free to try it. :)