Comment #1 on issue 380 by [email protected]: v:hlsearch doesn't work when in a function.
https://code.google.com/p/vim/issues/detail?id=380

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?

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui