bartqk · 2022-10-12 13:17
Is there an emacs plugin which allows to display a number next to the search results initiated by C-s and C-r such that the mentioned number represents how many times you need to press C-s or C-r to get to the search result?
Those counters would be live and would change depending on presses of C-s and C-r.
I'd prefer counters instead of using avy and playing game of pressing assigned letter. You can very quickly press C-s or C-r given number of times without making a mistake.
vifon · 2022-10-12 13:33
See if [ctrlf](https://github.com/radian-software/ctrlf) is to your liking. It seems to have this feature, among others.
bartqk · 2022-10-12 14:04
`ctrlf` is close, but couldn't configure it to do exactly what I'd like.
I want this:
buffer1:
```
[cursor here, press C-s, type single "a"]
a
a [1]
a [2]
a [3]
a [4]
```
Numbers in `[]` should be provided by the package.
yapfff · 2022-10-12 14:40
[Anzu](https://github.com/emacsorphanage/anzu) should be close to what you want. The info is in the modeline, see the snapshot on GH. It's in NonGNU ELPA too.
bartqk · 2022-10-12 15:18
Snapshot - you mean gifs? None of the gifs shows counters next to search matches.
[deleted] · 2022-10-12 16:06
[deleted]
deaddyfreddy · 2022-10-12 16:27
> Is there an emacs plugin which allows to display a number next to the search results
counsel, works well with avy too :]
> You can very quickly press C-s or C-r given number of times without making a mistake.
unless you have to press it more like 5 times or more :], moreover, you have to count, how many times you have to press C-s to get from entry N to entry M. So - more cognitive load, and O(n) vs O(logN)
_viz_ · 2022-10-12 16:39
See isearch-lazy-count.
Edit: Sorry, I misunderstood your question. You can still take a look at how the user option is handled to write what you want though.
mmarshall540 · 2022-10-12 21:58
That's almost exactly what some of Meow's commands do. Except that it doesn't do it for C-s/C-r (`isearch` commands), as far as I know.
It works with [Meow's commands for movement by word, line, block, and find/till](https://github.com/meow-edit/meow/blob/master/CUSTOMIZATIONS.org#meow-expand-hint-counts), which are single-letter search commands. These "expand-hint-counts" are updated as you move, and they allow jumping to any of the highlighted locations by pressing the displayed number.
I am not sure how hard it would be to use Meow to create a customized `isearch` command that would behave the same way, but it might be worth looking into.