Closed GoogleCodeExporter closed 9 years ago
This is done on purpose: the highlighting state is saved and restored for a user
function, see ':help :nohlsearch' and ':help function-search-undo'.
I believe this is done so that the user's last search state is not accidentally
changed by functions (or autocommands), which may do searches just to do their
work.
This is not documented in ':help v:hlsearch', but the help for :nohlsearch is
linked
from there.
Also, the documentation for @" mentions this: ':help "/', or a bit above ':help
@/'.
Not sure if this is a bug.
Maybe the v:hlsearch documentation should more clearly point this out? As in the
help for v:searchforward, which points this out and links to
'function-search-undo'.
Also, are you asking for a way to force setting the search state from a
function?
Original comment by odabr...@gmail.com
on 8 Jul 2015 at 1:37
Correction: please replace @" in the last comment with @/.
Original comment by odabr...@gmail.com
on 8 Jul 2015 at 1:44
Yeah, I guess improve g:hlsearch would be enough.
Thank you for the clarification.
Original comment by kassiobo...@gmail.com
on 8 Jul 2015 at 1:47
This patch adds two lines to the docs of v:hlsearch.
Original comment by odabr...@gmail.com
on 8 Jul 2015 at 2:45
Attachments:
Thank you!
Original comment by kassiobo...@gmail.com
on 8 Jul 2015 at 2:47
I'll include the patch, thanks.
Original comment by brammool...@gmail.com
on 8 Jul 2015 at 7:33
Original issue reported on code.google.com by
kassiobo...@gmail.com
on 8 Jul 2015 at 12:33