Reverse intelligent search (reverse-i-search), how

2020-02-25 13:55发布

When doing reverse intelligent search on a terminal (Ctrl+R), I can keep pressing Ctrl+R to go back in "history" and get older commands containing my search string.

How can I move back to a result which I have already displayed (a previous search result)?

1条回答
对你真心纯属浪费
2楼-- · 2020-02-25 14:18

I want to leave a reference for people who may find this, as the linked question actually asks for something else (even if one of the answers contains the solution to this problem).

The key binding to move forward is CTRLS.

The problem is that this binding, in many terminals, is used by default to send the pause transmission code (XOF).

As in man stty:

   [-]ixon
          enable XON/XOFF flow control

So, if you have this option enabled on your terminal (the output of stty -a contains ixon withouth the - sign in front), you cannot use CTRLS in the context of reverse-i-search.

To disable it, use the following command:

stty -ixon

And CTRLS will give you a (i-search) (non reverse).

查看更多
登录 后发表回答