0

When I search for a word in my files, many of them come up, and it's tough to tell which one my cursor is currently over.

See image:

enter image description here

Is there a way to edit the background color for the search I'm currently on? It would be great to turn the whole word a different color, instead of just the first character. You can't see it when the screenshot tool is open, but the actual effect is that the letter e that's currently outlined in fact inverts the foreground and background colors. That effect is great, but any way I can apply it to the whole word?

Other ideas on how to know which one I'm on are welcome : )

Here are the current lines in my color file that might be relevant:

hi IncSearch    ctermfg=0   guifg=#000000 ctermbg=223 guibg=#ffdfaf cterm=none gui=none
hi Search       ctermfg=0   guifg=#000000 ctermbg=149 guibg=#afdf5f

1 Answer 1

2

It looks like timakro/vim-searchant should do what you want:

enter image description here

This will set the current word red, although you can override it to some other color if you want.

3
  • Hahaa! It works, but it leaves a red stain behind after you escape the search. Feb 1, 2019 at 22:36
  • 1
    @Costa That's funny. You could post a bug-report for that. I had some issues when I tried out the plugin (n and * would throw errors, etc.), but I didn't spend much time looking into it, since it could be an incompatibility with one of my other plugins. (probably haya14busa/incsearch.vim if I had to guess), but if itworks for you that's good.
    – DJMcMayhem
    Feb 1, 2019 at 22:40
  • 1
    This solved it: let g:searchant_map_stop=0 nmap <Esc> <Plug>SearchantStop Help docs were sufficient : ) Feb 1, 2019 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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