Ralf Schmitt wrote:
Thanks for your quick answer!

Indeed, I mixed up command and option. So now I have
these entires in my .vimrc now

" enable highlighted search featue
set hlsearch
" disable highlighted search on startup
:nohlsearch
But this does not work either. My main goal is, that I don't
want to see 'old' searches highlighted on vim startup. Maybe
there is a better way to achieve this. Something like

set remember_old_searchpattern=off  ???

The register that contains your search is writeable using the "let" command. Registers are address by prepending @ to the register name, i.e. @/ is the search register, @" is the default copy (yank) register, etc.

let @/=''

That command will clear the search.

Why do you have anything in your search register upon vim startup anyway?

Albie
best regards

Ralf


Am Mittwoch, 24. Januar 2007 09:27 schrieben Sie:
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.




--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | <http://counter.li.org>

Reply via email to