junegunn/vim-oblique

Counts of search in Vim Oblique.

ReneFroger opened this issue ยท 10 comments

Hello Junegunn!

Thanks for sharing this awesome plugin with the Vim community. I really liked, especially when you're moving, the highlights will disappear.

I have an question. It was difficult to me to decide between 2 plugins with their own keymappings for / (the search). I decided in favor of vimoblique.

When I looked at the code of IndexedSearch, it seems not too much impossible to me, to integrate this in Vim Oblique? As example, it could be showed when you pressed enter in Vim Oblique?

An good example why Indexed Search could be useful, will you find here: https://www.youtube.com/watch?v=fwqhBSxhGU0

After switch to 1080p, start at 22:30 until 23:00

I basically agree that showing the index of the current match can be really useful.

The plugin you mentioned does not have an option to disable the default mappings, so we have to load it before Oblique, so that the mappings from Oblique override those from the plugin.

" Plug, Plugin, NeoBundle, or whatever
Plug 'IndexedSearch'
Plug 'junegunn/vim-pseudocl'
Plug 'junegunn/vim-oblique' " Oblique should appear after IndexedSearch

Then we hook ShowSearchIndex command to Oblique events.

" Clear autocommand
autocmd! User Oblique
autocmd! User ObliqueStar
autocmd! User ObliqueRepeat

" ShowSearchIndex on Oblique events
autocmd User Oblique       ShowSearchIndex
autocmd User ObliqueStar   ShowSearchIndex
autocmd User ObliqueRepeat ShowSearchIndex

It's the first time I tried the plugin so I can't be 100% sure, but it looks like it's working as expected.

One thing I noticed is that it's slow when there are many number of matches, and I keep pressing n after search. IndexedSearch does some tricks to avoid the slowdown (deferred echo on CursorHold event), but does not expose the functionality as public API. So if we want to take advantage of it, we have no choice but to fork it ๐Ÿ˜Œ

Thanks for your replies. I renamed the files with Pathogen, in order to alphabetically load IndexedSearch first and then your awesome plugin. It worked like charm!
As it seems, your plugin is still in experimental fase. You could integrate the fairly simple SearchIndexed script too into your plugin for other users, when you have any spare time to kill.

Thanks for helping me out, by the way!

No problem.

You could integrate the fairly simple SearchIndexed script too into your plugin

Maybe I could, thanks for the suggestion. I'll let you know when I decide to do so.

@ReneFroger
Hey, check out this fork of the plugin, it looks promising: https://github.com/henrik/vim-indexed-search

  • No default mappings: let g:indexed_search_mappings = 0
  • ShowSearchIndex (deferred) and ShowSearchIndex!

Thanks for that, it's seems to be a better alternative! Replaced IndexedSearch with his fork. My Vim is now more complete than it already was. ๐Ÿ˜„

Have a nice day! ๐Ÿ‘

@junegunn

Check out this too: https://github.com/osyo-manga/vim-anzu

  • Little more functionality than IndexedSearch.
  • Counts which hit you're currently on.

Thanks for the pointer. I'll take a look.

Thanks. Nothing new to me, but it made me recall a couple of minor issues of Oblique that should have been fixed.