3

I use swiper package to search and to navigate and I use C-n & C-p to search next and previous items. However, this doesn't go through the search items on the same line even though they are highlighted. I think it only cycles through the first items per given line.

Is there a way to move pointers to all search items even if they are on the same line?

I tries looking around for answers but was unsuccessful.

Any suggestions would be much appreciated.

chanyoungs
  • 53
  • 9

1 Answers1

5

Press C-' (swiper-avy) to select any visible candidate. Even if there are many candidates on the same line.

abo-abo
  • 13,943
  • 1
  • 29
  • 43
  • 2
    Note that this default key binding will probably not work when running Emacs in [some terminal emulators](https://superuser.com/a/764449/725601). See also https://unix.stackexchange.com/a/161725/230197. – Basil May 08 '17 at 14:41
  • 1
    Wow this is really excellent thank you abo-abo. But I would still be able to search for the 'next' search item in line like the default emacs search C-s if possible. Do you know if this possible? – chanyoungs May 08 '17 at 17:04
  • 1
    `swiper-all` is more similar to `isearch` in this respect. `swiper` is line-based, with all advantages and disadvantages it brings. – abo-abo May 09 '17 at 08:38
  • Thanks abo-abo `swiper-all` seems very close to what I want. It seems to require a minimum of 3 characters to search. Is there a way to change the setting to have no such minimum requirement? – chanyoungs May 09 '17 at 20:28
  • It's not reasonable. Without the limit, you'll just get the content of all your open buffers. Which is very slow. – abo-abo May 10 '17 at 09:58
  • Hmm. Doesn't isearch do exactly that? – chanyoungs May 15 '17 at 14:05
  • isearch is designed to not show the amount of matches, therefore it can afford to be lazy. swiper-all isn't lazy: it will go through all possible matches. Even though only ~10 matches will be displayed, all of them are processed and counted. – abo-abo May 15 '17 at 14:37
  • Wow, thanks for `swiper-all`, it's *incredibly* power/useful ; On a related note, do you guys know how to get the "last search term" by pressing the same key that invoked swiper in the 1st place, like `isearch-forward` does when you press `C-s` twice? – yPhil Mar 21 '18 at 11:43
  • `M-p` will show the previous search term from history. – abo-abo Mar 21 '18 at 13:04