In my .vimrc I've enabled highlighting the searched text (which I find to be a handy feature and wouldn't want to disable it).
set hlsearch
And, following answers to this question, I've made a mapping to be able to clear the highlight:
nmap <silent> ,/ :nohlsearch<CR>
The problem comes with commands which include search. For example, delete to next character 'x':
d/x
This will automatically highlight all the instances of 'x'. To remove this highlight I have to punch ,/
to clear it, which is quite annoying.
The question. Is it possible to enforce :nohl
if the search is a part of a preceding command? Maybe, it is possible at least for a selected list of commands (say, d
, y
and c
) before /
character is hit?