首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用pgUp和pgDn进行反向搜索

使用pgUp和pgDn进行反向搜索
EN

Stack Overflow用户
提问于 2013-06-17 01:49:20
回答 1查看 447关注 0票数 0

我在使用pgUp和pgDn从历史中自动完成搜索时遇到了一个奇怪的问题。

我在gnome-terminal中使用bash。

类型:

代码语言:javascript
复制
vim fil<pgUp>

预期输出:

代码语言:javascript
复制
vim filename

实际输出:

代码语言:javascript
复制
vim fil~

pgUp和pgDn都在终端上打印一个~字符,而不是搜索历史记录。

我想我在/etc/inputrc中有相关的行,但它们似乎没有帮助。有人能告诉我我哪里做错了吗?

这是我的输入,如果有人需要它的话:

代码语言:javascript
复制
# 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,如果相关的话。

代码语言:javascript
复制
set show-all-if-ambiguous off
set show-all-if-unmodified on
set completion-ignore-case on
EN

回答 1

Stack Overflow用户

发布于 2017-01-15 06:16:07

代码语言:javascript
复制
cat >> ~/.inputrc

"\e[5~": history-search-backward
"\e[6~": history-search-forward
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17136066

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档