Hi, in it's current implementation, 'hlsearch' works as following: * calling ":set hlsearch" for the first time after Vim has been launched: just expresses user's general preference of having their searches highlighted * searching a text: all occurences become highlighted * calling ":set nohlsearch": highlighted strings are reversed to their normal colors * calling ":set hlsearch" again: strings matched by the previous search are highlighted again * searching for another string: automagically turns 'hlsearch' on, if it was on when vim started
Unfortunatelly, this implementation tries to handle two unrelated things in one go: first, expressing user's general preference of their wanting/not wanting to have their searches highlighted; and second, turning on/off the highlights of the most recent search. This has some unwanted side effects: * I really love that Vim can be instructed to execute a file after it has been saved (using autocommands). This gives me a big speedup when coding short scripts. Hovewer, when I'm editing my .vimrc file, which contains the ":set hlsearch" command, every time I :source it, it highlights the results of my previous search. This can drive me nuts if it happens too often. * On some Linux distributions, Vim highligts the old search, even if it is the first time I run it in the morning. In that case, it highlights the last search from the previous day. Quite annoying, too. I had never a chance to debug this, but I suspect it has something to do with distribution maintainers creating and restoring sessions in global vimrc settings (in /etc). Proposed behaviour: * to use 'hlsearch' just for expressing user's general preference; * to stop the search commands modifying 'hlsearch' automatically; * to introduce two new commands, e.g. ":clearhl" and ":restorehl", which would allow the user to turn the highlitghts off. My main point here is that no problems arise if the feature is designed in a way in which no options are modified automatically. Best regards, Peter -- 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
