在bash中更改单词定界符 [英] Changing word delimiters in bash
问题描述
我想更改bash(或readline)用于分隔单词的定界符.具体来说,我想使'-'
不分隔单词,以便如果我有文字
I want to change the delimiters bash (or readline) uses to separate words. Specifically I want to make '-'
not delimit words, so that if I have the text
ls some-file
,然后按 Alt-Backspace
,它会删除整个 some-file
文本,而不仅仅是删除'-'
char.这也将导致长标记的删除,例如-group-directories-first
更快,更轻松,只需按一次键即可.
and I press Alt-Backspace
it deletes the entire some-file
text and not just up to the '-'
char. This will also cause deletions of long flags like --group-directories-first
faster and easier, needing only one key-press.
我相信这是zsh的行为方式,我希望使bash行为相同.
I believe that this is how zsh behaves and I'd like to make bash behave in the same way.
推荐答案
ctrl-w确实可以满足您的要求.
ctrl-w does exactly what you want.
这篇关于在bash中更改单词定界符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!