inputrc中单行上的两个命令

时间:2011-06-08 08:25:31

标签: bash unix

我想使用“向上”键在我的bash shell中向上移动历史记录,但是当我这样做时:

"\e[A": history-search-backward
"\e[B": history-search-forward
     

点击“向上”后,光标不转发到单词的结尾。   如何连接两个命令?我试过了       “\ e [A”:历史搜索 - 后退行尾   以及其他事情,没有任何效果......

感谢。

1 个答案:

答案 0 :(得分:1)

将此添加到您的.inputrc

# By default up/down are bound to previous-history
# and next-history respectively. The following does the
# same but gives the extra functionality where if you
# type any text (or more accurately, if there is any text
# between the start of the line and the cursor),
# the subset of the history starting with that text
# is searched (like 4dos for e.g.).
# Note to get rid of a line just Ctrl-C
#"\M-[A": history-search-backward
#"\M-[B": history-search-forward
"\e[B": history-search-forward
"\e[A": history-search-backward