When I search in Vim (in the terminal), I sometimes find it really hard to see the matches. I'm trying to configure vim to color the matches in a way that stands out more. I added the row below to $HOME/.vimrc
:
hi Search term=none ctermbg=red ctermfg=white guifg=green guibg=Purple
Although the configuration I added in .vimrc
appears when I run :hi Search
in vim, the search results coloring remains as before (reverse coloring on the first letter in the match). What am I doing wrong? Why is my configuration being ignored, and how can I fix it?
:hi Search
returns the following line:
Search xxx ctermfg=15 ctermbg=9 guifg=green guibg=Purple
I'm running vim 9.1:
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 16 2025 20:13:18)
Included patches: 1-16, 647, 678, 697
On ubuntu 24 in foot.
Stackexchange suggested the question below which is similar to mine and now I'm wondering if the same goes for the Search highlight: Why is `:highlight Cursor ...` ignored?
:help colorscheme-override
or search for it on this site. If you run your:hi
command as an:autocmd
, it will work.set hlsearch
in ~/.vimrc solves my problem since it makes all the search results stand out, but I can't configure what colors they have.