为什么 Ctrl+箭头会让我的终端切换到奇怪的模式?

为什么 Ctrl+箭头会让我的终端切换到奇怪的模式?

当我在其中输入 Ctrl+Left 或 Ctrl+RightGuakegnome-terminal最后一个的行为变成某种非正常模式时:按键-的行为类似于arrow up+运行Nano 等。我如何禁用此功能arrow downv特征

更新:我的朋友告诉我那是 X.org 热键...我该如何禁用它们?谷歌搜索毫无帮助...

UPD2这是显示正在发生的事情的视频。

答案1

解决方案非常优雅且简单:编辑/etc/inputrc并禁用vi mode.

这是更新后的inputrc文件:

# /etc/inputrc - global inputrc for libreadline
# See readline(3readline) and `info rluserman' for more information.

# Be 8 bit clean.
set input-meta on
set output-meta on

#set editing-mode vi

# To allow the use of 8bit-characters like the german umlauts, uncomment
# the line below. However this makes the meta key not work as a meta key,
# which is annoying to those which don't need to type in 8-bit characters.

# set convert-meta off

# try to enable the application keypad when it is called.  Some systems
# need this to enable the arrow keys.
# set enable-keypad on

# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys

# do not bell on tab-completion
# set bell-style none
# set bell-style visible

# some defaults / modifications for the emacs mode
#$if mode=emacs

# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line

# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert

# mappings for "page up" and "page down" to step to the beginning/end
# of the history
# "\e[5~": beginning-of-history
# "\e[6~": end-of-history

# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward

# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word

$if term=rxvt
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word
$endif

# for non RH/Debian xterm, can't hurt for RH/Debian xterm
# "\eOH": beginning-of-line
# "\eOF": end-of-line

# for freebsd console
# "\e[H": beginning-of-line
# "\e[F": end-of-line

#$endif

应该阅读更多有关该模式的信息。谢谢大家不辞辛苦!

答案2

我也遇到过同样的问题。我的/etc/inputrc配置正确,但由于一些奇怪的原因,我进行了骨架配置,~/.inputrc然后禁用了/etc/inputrc.

所以,我的解决方案是:

rm ~/.inputrc

答案3

根据nano's标题栏,按下 后您正在编辑 bash 历史记录文件v

/tmp/bash-fc-1212173730

我怀疑Ctrl-LeftCtrl-Right正在激活交互式历史模式。

您是否.bashrc包含history-search-backward和 的绑定history-search-forward

.bashrc您可以通过注释掉或删除或 中的任何绑定行来禁用此行为.bash_aliases

相关内容