在ZSH杀戮/猛击(剪切/粘贴)

时间:2021-10-08 19:18:53

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.

我使用zsh并为其设置了Emacs键绑定。我很想让它复制我所有常规的Emacs文本操作命令。我想念的是Kill / Yank键。如果我可以选择文本(使用C-SPC - 这可行)然后执行类似kill-region(C-w - 现在删除前一个单词)的话会很好。猛拉(C-y)工作正常,我甚至可以使用M-y循环它们。

Does anyone have such a setup working?

有没有人有这样的设置工作?

1 个解决方案

#1


9  

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

一个简单的“\ C-w”:我的.inputrc文件中的kill-region将键绑定到我想要的函数。


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

更新:太快说了。以上仅适用于使用readline库的应用程序。 Zsh使用自己的zle。配置类似行为的方法是将bindkey“\ C-w”kill-region粘贴到.zshrc中

#1


9  

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

一个简单的“\ C-w”:我的.inputrc文件中的kill-region将键绑定到我想要的函数。


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

更新:太快说了。以上仅适用于使用readline库的应用程序。 Zsh使用自己的zle。配置类似行为的方法是将bindkey“\ C-w”kill-region粘贴到.zshrc中