Ralf Schmitt wrote:
Hi all,
I'm a bit confused about the hlsearch feature of v7.
In my .vimrc I set "set nohlsearch" to disable highlighting
of search results on startup.
:help nohlsearch says
Stop the highlighting for the 'hlsearch' option. It
is automatically turned back on when using a search
command, or setting the 'hlsearch' option.
But when I search by "/" nothing gets highlighted! The
highlighting comes back when I do "!hls"
What am I missing? Isn't it possible to activate this feature
on first usage of a vim session?
best regards
Ralf
The ":nohlsearch" COMMAND sets search highlighting temporarily off until next
search.
The 'hlsearch' / 'nohlsearch' OPTION enables or disables search highlighting
permanently.
:set nohlsearch
disables all search highlighting.
:set hlsearch
enables all search highlighting.
:nohlsearch
disables it until next search, at what time it will be
re-enabled if 'hlsearch' is on.
!hls
ought to give a shell message, similar to:
Unknown command or file name: "hls"
However, on my system it gets translated to :.!ls
and writes a directory listing into the current buffer.
:set hls!
:set invhls
toggles the boolean option: enables highlighting if disabled,
or vice-versa.
:help nohlsearch
doesn't find the exact thing you asked for, and gives you
":help :nohlsearch" (help for the command)
:help 'hlsearch'
:help 'hls'
:help 'nohlsearch'
:help 'nohls'
finds the help for the option.
Morality: Computers are literal-minded. If you ask a computer to second-guess
you, you're asking for trouble.
Best regards,
Tony.