Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kill/Yank (cut/paste) in ZSH

I use zsh and have the Emacs keybindings set up for it. I'd love to have it replicate all my regular Emacs text manipulation commands. One which I miss is the Kill/Yank keys. It would be nice if I could select text (using C-SPC - this works) and then do something like a kill-region (C-w - This right now deletes the previous word). The yank (C-y) works fine and I can even even cycle through them using M-y.

Does anyone have such a setup working?

like image 599
Noufal Ibrahim Avatar asked Jan 25 '10 09:01

Noufal Ibrahim


1 Answers

A simple "\C-w": kill-region in my .inputrc file binds the key to the function I want.


Update: Spoke too soon. The above only does it for applications that use the readline libraries. Zsh uses its own zle. The way to configure similar behaviour is to stick bindkey "\C-w" kill-region into your .zshrc

like image 149
Noufal Ibrahim Avatar answered Sep 23 '22 09:09

Noufal Ibrahim