zsh WORDCHARS

At the shell prompt, I want to directories in a path to act like words, so that I can kill them one by one. So I added to my .zshrc

WORDCHARS="${WORDCHARS:s#/#}"

which takes the value of WORDCHARS, removes slash, and assigns back to WORDCHARS. I could also hardcode a literal value like:

WORDCHARS='*?_-.[]~=&;!#$%^(){}<>’

but the former is self-documenting while the latter reads like line noise, or Perl =)

References: