Re: hlsearch question
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.
Re: hlsearch question
Hi Ralf :) * Ralf Schmitt [EMAIL PROTECTED] dixit: 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. This way, you've effectively turned off search highlighting, no matter of :nohl command. :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. Unfortunately, both the setting and the command have almost the same name. The *command* :nohlsearch turns off search highlighting temporarily, so it doesn't clutter your display. It is turned on again if you do any new search. If you do set nohlsearch, you will never get search highlighting. Raúl Núñez de Arenas Coronado -- Linux Registered User 88736 | http://www.dervishd.net It's my PC and I'll cry if I want to... RAmen!
Re: hlsearch question
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 ??? 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.
Re: hlsearch question
: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 ??? best regards Ralf Method I: :set viminfo+=h This sets a flag in the viminfo file, so that the last search before the restart will not be displayed even if 'hlsearch' is on. This will only be effective after the _next_ time the viminfo is loaded, i.e., probably the next run of Vim after this flag is set. Method II: :let @/ = This sets the latest search register to the empty string, so that nothing will be highlighted. Earlier searches can still be remembered by using the Up key after hitting / or ? and optionally the start of the string to be searched. See :help 'viminfo' :help :let-register Best regards, Tony.
Re: hlsearch question
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
Re: hlsearch question
A.J.Mechelynck wrote: Albie Janse van Rensburg wrote: [...] Why do you have anything in your search register upon vim startup anyway? Because the viminfo file remembers (among others) the search history. Best regards, Tony. Thanks. I didn't realize that. -- Albie Janse van Rensburg (neonpill) Registered Linux User 438873 | http://counter.li.org
hlsearch question
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