我在使用 pgUp 和 pgDn 自动完成历史搜索时遇到了一个奇怪的问题。
我在 gnome-terminal 中使用 bash。
类型:
vim fil<pgUp>
预期输出:
vim filename
实际输出:
vim fil~
pgUp 和 pgDn 都在终端上打印 ~ 字符,而不是搜索历史记录。
我想我的 /etc/inputrc 中有相关的行,但它们似乎没有帮助。有人可以告诉我我在这里做错了什么吗?
如果有人需要,这是我的 inputrc:
# do not bell on tab-completion
#set bell-style none
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
# Completed names which are symbolic links to
# directories have a slash appended.
set mark-symlinked-directories on
$if mode=emacs
# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# commented out keymappings for pgup/pgdown to reach begin/end of history
#"\e[5~": beginning-of-history
#"\e[6~": end-of-history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
#"^[[5~": history-search-backward #these are the values read gives for pgUp, pgDn. They don't work either.
#"^[[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e[1;5C": forward-word
"\e[1;5D": backward-word
# for rxvt
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word
# 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
还有我的 ~/.inputrc 如果它是相关的。
set show-all-if-ambiguous off
set show-all-if-unmodified on
set completion-ignore-case on