开发者

Two commands on a single line in inputrc

开发者 https://www.devze.com 2023-03-11 00:23 出处:网络
I\'d like to use the \"up\" key to mo开发者_开发问答ve up through history in my bash shell, but when I do this:

I'd like to use the "up" key to mo开发者_开发问答ve up through history in my bash shell, but when I do this:

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

After hitting "up", the cursor doesn't forward do the end of the word. How can I concatenate two commands? I tried "\e[A": history-search-backward end-of-line as well as other things and nothing worked...

Thanks.


Add this to your .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
0

精彩评论

暂无评论...
验证码 换一张
取 消