Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently learned a new shortcut in VIM that I find extremely useful.


Which will delete everything up to, but not including, "search_text", from the current position.

However, the thing that is annoying is that this will highlight all occurrences of "search_text" after performing the operation.

Is there any way that I could disable the highlight feature when performing this operation?

share|improve this question
up vote 2 down vote accepted



I need to add more to overcome the post size limit.

share|improve this answer
My current solution was to type /sdgsah Or some other string that probably does not exist in the document. But see, both of these solutions are annoying - turning things on and off. Or searching for something that does not exist, in my 'solution'. – mateusz Apr 4 '12 at 19:51
:noh is more "correct", though I agree that it's a pain to type. That's why I have it mapped to a shortcut key. I have map <F5> :nohls<CR> in my .vimrc, but which key you use is up to you. I picked <F5> because I use this so much it made sense to pick a prominent, single key. – MikeSep Apr 5 '12 at 14:29

Seems like overkill to mess with the 'highlightsearch' setting just for this delete operation, but you could.

:set nohls
:set hls

There are more complicated ways, but they would require writing a function, or grabbing input.

share|improve this answer

I hate it so I leave hlsearch off (its default value) but have set incsearch in my ~/.vimrc.

Matching is done incrementally, the first occurence is highlighted and goes back to normal upon hitting <Return>. It's incredibly clean and useful.

See :help incsearch.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.