wincent / loupe

🔍 Enhanced in-file search for Vim
BSD 2-Clause "Simplified" License
144 stars 6 forks source link

Include search indices #8

Open pwntester opened 8 years ago

pwntester commented 8 years ago

Hi,

You may want to add search indeces as in vim-anzu (https://github.com/osyo-manga/vim-anzu) to complete a solid search replacement.

Thanks! A

wincent commented 8 years ago

I guess the indices are the (18/45) etc that you can see in the screenshot. What's the benefit of them? How do you use them?

pwntester commented 8 years ago

I use it for multiple purposes:

thanks, A

damnskippy commented 8 years ago

@pwntester You might want to take a look at my comments at #7 on how different functions can be stacked. I use another plugin providing similar functionality. In all fairness, there are several search related plugins out there and while it would be ideal/nice to have one plugin that consolidates all our favorite features in one place, it is probably unfair or perhaps too much to ask for, and may or may not in the author's interest for a given plugin to do so. So long as one has the option to stack the functionality that should in theory achieve the same effect. Just my humble thought.

@wincent I too like @pwntester really value knowing how many matches are found for a given search, and knowing where I am (match number) in a given file, and find it useful to know when I'm at the first match or last match or exactly where in between. Not unlike similar functionality sported in browsers, other editors, etc.

pwntester commented 8 years ago

thanks @damnskippy, which plugin do you use for this purpose? I had some troubles in the past with vim-anzu ...

damnskippy commented 8 years ago

https://github.com/henrik/vim-indexed-search

wincent commented 8 years ago

@pwntester:

Once they are identified by the index is quicker for me to go to the right match

Just to clarify, do you mean by hopping there with n or N or similar? Or does the plug-in provide some other shortcut for it?

@damnskippy:

So long as one has the option to stack the functionality that should in theory achieve the same effect.

Yes, my preference is to make my plug-ins play nicely with other plug-ins without trying to be everything to everybody. At the same time, if a feature is compelling (ie. I would use it myself) and can be added without making too many trade-offs (complexity, performance hit for people who don't care about the feature etc), I'm happy to add it.

pwntester commented 8 years ago

@wincent yep, I use <number>n or <number>N to go to a specific match

mrossinek commented 4 years ago

Just to give an update on this: A number of "recent" patches introduced a search statistics feature into vim directly. When ported to neovim they were summarized quite nicely, here: https://github.com/neovim/neovim/pull/10114

Furthermore, as seen here (https://github.com/neovim/neovim/pull/10136), these statistics are shown by default in neovim. However, currently it sometimes does not work when n/N are remapped. This appears to be the case with loupe although I did not have the time to dig into the code to find out why this is the case.

I only noticed this yesterday but I would really like to see if there is a fix for this.

wincent commented 4 years ago

It does seem a bit buggy. I'm currently running some build of Neovim that I made on the master branch a while back; not sure exactly what rev, but :echo has('patch1270') shows I have the changes from https://github.com/vim/vim/commit/9dfa3139198b38b28673e251a3756430065914e9 and my 'shortmess' is filnxFAIOTWacots (ie. no S). I can see the x/y counts when moving around with n and N, but not always.

yujinyuz commented 1 month ago

Probably late but I'll just comment it here in case anyone encounters a similar issue as I just figured out why search indices are not updating.

I had a simple mapping nnoremap n nzzzv and was wondering why it works on a clean install but not on my current config. Turns out that I have lazyredraw enabled and that prevented it from updating the search indices. Turning it off makes it work