Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Make `Ctrl + W` and `Ctrl + Shift + H` in zsh behave the same as in bash



Hi everyone,

I've recently started using zsh and I like it. However, coming from bash, some little things I miss.


*The problem:*

In bash behavior is like this:

 * Ctrl + W deletes the word behind the cursor up to the next space
 * Ctrl + Shift + H deletes the word behind the cursor up to the next
   seperation charcater like ., ,, -, / etc.

In zsh both Ctrl + W an Ctrl + Shift + H behave like the latter one in bash. I would like the same behavior as in bash.



*This is what I've tried:*

   SPACE_WORDCHARS='~!#$%^&*(){}[]<>?.+;-_/\|=@`'
   backward-delete-word() WORDCHARS=$SPACE_WORDCHARS zle .$WIDGET
   zle -N backward-delete-word
   bindkey "^W" backward-delete-word

This works, however, it breaks the functionality that deleting a word puts the word on the paste buffer, so I can't then paste this word with Ctrl + Y. This is quite important functionality for me. To be honest I'm not completely sure how this zle function works and what .$WIDGET does. Would anyone know a way how I can make this work while retaining the cut/paste behavior?


Many thanks,
Rik



Messages sorted by: Reverse Date, Date, Thread, Author