[EMAIL PROTECTED] wrote:
Hi, everyone,
The 'hlsearch' can be turned off by :set nohls
You must be confusing ":nohls" with ":set nohls" (see below).
However, it will be automatically turned on when I'd done a search, which
is annoying me.
What I want is that it will not be turned on automatically. but it will be
turned on when I :set hlsearch. (i.e. only when I really need it)
Is it possible to do that?
--
Sincerely, Pan, Shi Zhu. ext: 2606
Sure.
:set nohlsearch
disables Search highlighting permanently;
:set hlsearch
enables it; and
:set invhlsearch
or
:set hlsearch!
toggles it. In addition,
:nohlsearch
(without "set") turns it off temporarily (until the next search or
substitute). Also, the setting of the 'viminfo' option has an influence
on what will happen the next time you start Vim: if 'viminfo' includes
the "h" flag, Vim will start the next time with no Search highlight, at
least until the first search. If the "h" flag is absent, Vim will start
with the latest search pattern (of the previous session) highlighted if
'hlsearch' is on and ":nohlsearch" has been used neither between the
last search and closing Vim, nor in the vimrc used by the new session.
Best regards,
Tony.