vim-cool
vim-cool copied to clipboard
wrapping de-highlights all matches when the very first word of the buffer is a match
When the first match is the very first word of the buffer, and you wrap from the very last match back to it via n, all matches are de-highlighted until you jump to the second match.
This can be avoided with this change:
endif
let g:cool_is_searching = 1
let [pos, rpos] = [winsaveview(), getpos('.')]
- silent! exe "keepjumps go".(line2byte('.')+col('.')-(v:searchforward ? 2 : 0))
try
silent keepjumps norm! n
+ silent keepjumps norm! N
if getpos('.') != rpos
throw 0
endif
This also fixes the issue that ?3
removes the highlight if the 3
is matched at the end of a line. It's because exe "keepjumps go".(line2byte('.')+col('.')
does not move the cursor at the end of a line.