vim-sneak
vim-sneak copied to clipboard
Labels are not shown for last partially displayed line
Thanks a lot for the plugin. I generally work in label mode and have set display+=lastline in my .vimrc to show as much as possible of the last visible line.
In that case, sneak correctly highlights all my search results but does not attribute labels to any of the results in the last partially displayed line. If the display option is set to "" or if the last line is displayed entirely, everything works perfectly fine.
Can't imagine what sneak logic would have this effect since the plugin just asks vim to search for text and highlight it. Can you try adding + 2
here: https://github.com/justinmk/vim-sneak/blob/95374ad3e4b5ef902854e8f4bcfa9a7a31a91d71/autoload/sneak/search.vim#L43-L45
like this:
return self._reverse ? line("w0") : (line("w$") + 2)
Great! Works like a charm, thank you. +1
even seems to be enough to capture the remaining line.
A slight problem with this simple solution is that it labels invisible positions now, which might result in surprising behaviour - isn't there a way to check whether a match is actually on screen, before the @@@
part?
A slight problem with this simple solution is that it labels invisible positions now, which might result in surprising behaviour
yeah :(
isn't there a way to check whether a match is actually on screen, before the
@@@
part?
idk, grateful if anyone finds a hint.
idk, grateful if anyone finds a hint.
Checking the screenpos
of the matches could be a solution - at least that is what I thought. The problems are:
-
screenpos
is incredibly slow for lots of matches (this can be mitigated with some kind of bisecting approach though). - It doesn't actually work. (IMO, ignoring these partial lines can be considered buggy, or at the very least surprising behaviour from
screenpos()
.)