From what I understand, you want to properly configure GNU-readline (which handles text edition at GNU-bash's prompt)
In Bash, you can type
bind '"\ew": backward-kill-word'
Then test.
To make this permanent, as a user, you can edit ~/.inputrc
, which takes priority over the system config in /etc/inputrc
. You can $include /etc/inputrc
in ~/.inputrc
to inherit from it.
You want to have this line:
"\ew": backward-kill-word
This often defaults to unix-word-rubout
, or even a shell or bash prefixed macro, which takes only white space as a delimiter. But backward-kill-word
will take anything that is "not a letter nor a digit".
Refer to man 3 readline
for full documentation.