zsh:在目录分隔符上停止向后杀字
在 zsh 中,如何设置行编辑器以便 backward-kill-word
停在目录分隔符上? 目前在我的 bash 设置中,如果我输入
cd ~/devel/sandbox
然后点击 Cw
点将位于 devel/
之后。 在我的 zsh 设置中,点将位于 cd 之后。 我想设置 zsh,使其行为与 bash 类似。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
对于 zsh 的最新版本,您只需将: 添加
到您的 zshrc 中,如 中所述zsh 手册(也称为 man zshcontrib)。
For recent versions of zsh, you can simply add:
to your zshrc as described in the zsh manual (also
man zshcontrib
).另一种选择是将
WORDCHARS
(视为单词一部分的非字母数字字符)设置为不包含/
的内容。如果您希望
^w
在点、下划线等处中断,您也可以调整此设置。在~/.zshrc
中,我有: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:这对我有用。 需要
unspecified
word-style,否则 zsh 似乎不尊重WORDCHARS
。在此处输入代码
以下是有关其工作原理的更多信息。
Here's what worked for me.
unspecified
word-style was required otherwise zsh didn't seem to respect theWORDCHARS
.enter code here
Here's more info on why this works.
快速谷歌显示:
向后终止
或者,也许是更好的解决方案:
Bash 风格向后杀
A quick google reveals:
Backward Kill
Or, perhaps a better fix:
Bash Style Backward Kill