Is there any WORDCHARS alternative in Bash?

575 views Asked by At

Conculusion:

  • No WORDCHARS alternative in Bash, where C-w ends can't be configured.
  • mysql depends on editline, which is customizable with ~/.editrc.
  • redis-cli depends on linenoise, it deletes the whole word without considering :, -

In zsh, WORDCHARS controls the behavior of C-w when deleting a word. Is there any alternative in readline?

I've noticed recently the behavior of C-w in mysql/redis-cli differs that in Bash, although both of which depends on readline?

Take string foo:bar as an example, only bar is deleted by C-w in Bash. While in mysql/redis-cli, the whole word foo:bar is deleted.

How do I control this behavior?

1

There are 1 answers

3
Philippe On BEST ANSWER

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

Run following command to find out what C-w is bound to

bind -P | grep C-w

Seems bash doesn't have WORDCHARS as in zsh