如何在我的 .inputrc 中覆盖 bash 中的 Control+W?以下内容本身不起作用:
"\C-w": forward-word
当我添加 stty werase undef
时,它确实起作用,但随后“s”键神秘地被禁用了!
最佳答案
您需要在 .inputrc
文件中使用选项 set bind-tty-special-chars Off
以绑定(bind) ^W
像那样。原因是:
Readline, beginning with version 5.0, reads the stty special character settings and binds them to their readline equivalents each time readline() is called from bug-bash mailing list
bind-tty-special-chars
选项在 5.1 中被引入以解决这个特性。 Readline Changes - 搜索选项
set bind-tty-special-chars Off
"\C-w": forward-word
稍微老派的方法涉及 .bashrc
,例如:
stty erase undef
bind '"\C-w": forward-word'
关于linux - .inputrc 覆盖 Control+W,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23349325/