简体   繁体   English

Bash 中是否有任何 WORDCHARS 替代品?

[英]Is there any WORDCHARS alternative in Bash?

Conculusion:结论:

  • No WORDCHARS alternative in Bash, where Cw ends can't be configured. Bash 中没有WORDCHARS替代项,其中无法配置Cw端。
  • mysql depends on editline , which is customizable with ~/.editrc . mysql依赖于editline ,可以使用~/.editrc进行自定义。
  • redis-cli depends on linenoise , it deletes the whole word without considering : , - redis-cli依赖linenoise ,它会删除整个单词而不考虑: , -

In zsh, WORDCHARS controls the behavior of Cw when deleting a word.在 zsh 中, WORDCHARS控制Cw在删除单词时的行为。 Is there any alternative in readline? readline 有什么替代方案吗?

I've noticed recently the behavior of Cw in mysql / redis-cli differs that in Bash, although both of which depends on readline ?我最近注意到mysql / redis-cliCw的行为与 Bash 中的行为不同,尽管两者都取决于readline

Take string foo:bar as an example, only bar is deleted by Cw in Bash.以字符串foo:bar为例,Bash 中只有barCw删除。 While in mysql / redis-cli , the whole word foo:bar is deleted.而在mysql / redis-cli中,整个单词foo:bar被删除。

How do I control this behavior?我该如何控制这种行为?

There are two commands to do backward kill word:有两个命令可以执行反向杀词:

backward-kill-word
unix-word-rubout

backward-kill-word deletes bar , unix-word-rubout deletes foo:bar backward-kill-word删除barunix-word-rubout删除foo:bar

Run following command to find out what Cw is bound to运行以下命令以找出Cw绑定到的内容

bind -P | grep C-w

Seems bash doesn't have WORDCHARS as in zsh似乎 bash 没有 zsh 中的 WORDCHARS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM