Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have changed my Vim colours so when I do a /search, every match is highlighted in bright yellow. This makes matches much easier to see.

However, when I perform a substitution with the confirm flag like :%s/find/replace/gc all the items are highlighted in yellow, which is fine, but I can't tell which item Vim is asking me to confirm.

How can I highlight the current substitution item in another colour so I can see what needs confirming?

share|improve this question
1  
See superuser.com/questions/86604/… . –  Daniel Andersson Apr 13 '12 at 15:57
    
Thanks, that was helpful :) –  jordelver Apr 13 '12 at 21:52
add comment

1 Answer

up vote 1 down vote accepted

The highlight group you want is "IncSearch" even if you don't have the the 'incsearch' option enabled—it is also used for the current substitution when confirmation is enabled.

See ":help hl-IncSearch".

share|improve this answer
    
Thanks, that's exactly what I needed. I need to play around with colors now :) –  jordelver Apr 13 '12 at 20:14
    
Follow up question. Is it possible to highlight matches when going through each one with n and N when just searching normally? –  jordelver Apr 13 '12 at 20:46
    
I'm assuming you don't mean just enabling 'hlsearch'? I don't think the "current" match can be highlighted different than all matches, but I haven't needed it since the cursor moves to the current match with n/N. –  Heptite Apr 13 '12 at 22:54
    
Sorry, wasn't clear. I've set different colours for IncSearch and Search. When I /searchterm, the match is highlighted in the IncSearch colour. When I hit enter so I can press n to jump to each match, all matches turn to the Search colour. What I want is to change the colour of each match as I jump to it. Does that make sense? :) This is what happens now with :%s/find/replace/gc. Each match is highighted a different colour as I press y or n. –  jordelver Apr 14 '12 at 9:04
    
Yeah, like I said, there's no option to do this. I don't think it is considered necessary since the cursor is supposed to be on the current match in this context, and that should be a fairly clear indicator. –  Heptite Apr 14 '12 at 18:06
show 1 more comment

Your Answer

 
discard

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.