Alex Rivera | Logout

zsh: stop backward-kill-word on directory delimiter

Asked 2009-01-14T22:30:13.683
86

In zsh, how can I set up the line editor such that backward-kill-word stops on a directory separator? Currently in my bash setup, if I type

cd ~/devel/sandbox

and then hit C-w point will be right after devel/. In my zsh setup, point would be after cd . I'd like to set up zsh so it behaves similarly to bash.

zsh
Edit
Report

1 Answer

92

Another option is to set WORDCHARS (non-alphanumeric chars treated as part of a word) to something that doesn't include /.

You can also tweak this if you'd prefer ^w to break on dot, underscore, etc. In ~/.zshrc I have:

WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
answered 2012-06-26T05:01:55.743

Your Answer