linux - .inputrc 覆盖 Control+W

标签 linux unix readline stty

如何在我的 .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/

相关文章:

linux - 如何使用 linux 命令将包含十六进制的文本文件转换为二进制文件?

linux - Unix,替换错误错误?

c - 如何在 C 中给定父 PID 时获取所有子进程的 PID

python - 如何从同一行的 txt 文件中读取两个变量?在 python

c - 使用 readline 防止回车输出

python - 在 mac 上使用 readline 安装 ipython

linux - linux中如何同步socket服务器和客户端之间的通信速率

linux - Linux 程序员如何在不使用 IDE 的情况下创建 GUI 应用程序?

linux - 如果特定字符串在 bash 中使用 sed 在模式之间匹配,则在前后添加字符串

linux - Apache 日志 : Count top 10 URLs by bytes served