11

I'm running iTerm2. When do a text search F, pressing Return moves the highlighted occurrence back (the previous occurrence). Is there a way to make it move to the next (forward) occurrence?

3 Answers 3

8

Searching in reverse is apparently how iTerm's search works by design (see https://gitlab.com/gnachman/iterm2/issues/4491).

As a user, I also find this design decision confusing.

If you would like to make Find Next / Find Previous in iTerm behave consistently with other apps, here are the proper keybinding overrides to add in System Preferences > Keyboard.

Note that I had to restart iTerm for the keybindings to fully take effect.

iterm find keybinding overrides

4
  • Can I ask what is going on with the "Function Keys" entry in your settings here? I do not have that on Mac os mojave, I don't think I've ever seen it Dec 28, 2019 at 1:50
  • @DevinGRhode It looks like Function Keys is related to the MacBook Pro touch bar. Any chance you are working on a non-touch bar machine? Mar 9, 2020 at 19:34
  • 1
    I was working on a non-touchbar machine, yes. Mar 9, 2020 at 21:08
  • 3
    This is a stupid design decision but thanks for the workaround Jun 10, 2020 at 16:43
4

Like @Taylor D. Edmiston said, this is iTerm's default behavior. However, there's now an iTerm2 setting in Preferences > Advanced > General to revert that behavior to "normal" when set to "No" (next is down, previous is up):

https://gitlab.com/gnachman/iterm2/-/issues/2049

Commit a99ed9b1 adds an advanced preference named "Swap Find Next and Find Previous". It defaults to "Yes". When disabled, search acts like a standard application. The only thing the setting does not affect is key bindings, which presumably work the way you want, and are also labeled "find up" and "find down" which is unambiguous.

The numeration is still "backward" (e.g. 1/20 will be the lowest down text match) but otherwise works the same as you would expect of other applications.

Swap Find Next and Find Previous Setting

-2

Try using Shift+Enter to reach the next occurrence.

4
  • 1
    We're looking for long answers that provide some explanation and context. Don't just give a one-line answer: please explain why you're recommending it as a solution. Answers that don't explain anything may be deleted.
    – Allan
    May 2, 2016 at 17:39
  • I apologize, I'm new here. I tried to find documentation on the internet to back up my personal experience, and I found this thread. In the future, should I find a source on the web with my answers? groups.google.com/forum/#!searchin/iterm2-discuss/find/…
    – TMHahn
    May 2, 2016 at 17:43
  • That's ok...it's how we learn.....but I don't belive shift-enter does anything in this context. You might want to try Cmd-G or just Enter
    – Allan
    May 2, 2016 at 17:54
  • Cmd-G also works in reverse
    – tar
    Feb 16, 2017 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .