Can't read when Vim/Neovim highlight same color as text

Issue

I’ve been trying to take my vim/neovim game to the next level and one of the things I’ve been trying to do is fix the highlighting issues I’ve been having. The gist of it is that at times, syntax, visual selection, and search highlighting use the same/similar color for the highlighting as the original text, making it difficult to see what has been highlighted. Does anyone know how i might be able to fix this? based on the first screenshot, it looks like its completely capable of doing so, I just can’t seem to find a config option to make it consistent.

Here are some examples (while I was using neovim in these, the behavior is the same w/ vim):

note how the some of the text is almost impossible to read while highlighted?  (it was whitish before highlighting)  the places highlighted in red/blue are much more how i would have expected highlighting to work all the time (the highlight color more or less matches the original text color, but when highlighted, the text color was changed to make the selection readable). note how the some of the text is almost impossible to read while highlighted? (it was whitish before highlighting) the places highlighted in red/blue are much more how i would have expected highlighting to work all the time (the highlight color more or less matches the original text color, but when highlighted, the text color was changed to make the selection readable).

all occurrences of "if" are highlighted.  again, note how the text and highlighting are pretty much indistinguishable.all occurrences of “if” are highlighted. again, note how the text and highlighting are pretty much indistinguishable.

note how the syntax highlighting (of the [ ] pair in this case) mostly hides what the 2 surrounding characters are.  this also happens with (, ), {, and }.note how the syntax highlighting (of the [ ] pair in this case) mostly hides what the 2 surrounding characters are. this also happens with (, ), {, and }.

.vimrc (init.vim essentially identical):

syntax enable
:color peachpuff
set nocp
set wildmenu
set relativenumber
set number
set ignorecase
set smartcase
set incsearch
set nowrap
set tabstop=4
set softtabstop=4
set expandtab
set shiftwidth=4
set showcmd
set clipboard=unnamed
set laststatus=2
set clipboard+=unnamedplus
set directory=~/.vim/tmp

"sudo after opening:
cmap w!! w !sudo tee >/dev/null %

"formatting brackets and such:
inoremap {<Tab> {}<Esc>i
inoremap {<CR> {<CR>}<Esc>ko<Tab>
inoremap (<Tab> ()<Esc>i
inoremap (<CR> (<CR>)<Esc>ko<Tab>
inoremap [<Tab> []<Esc>i
inoremap [<CR> [<CR>]<Esc>ko<Tab>

Solution

Just try a different colorscheme. This plugin has loads:
https://github.com/flazz/vim-colorschemes

I’d recommend gruvbox, twilight or apprentice, but there are lots of great ones, find one that works for you.

You can install this plugin to be able quickly switch to the next colorscheme:
https://github.com/xolox/vim-colorscheme-switcher

Edit: here is a list of the colorschemes that you probably have installed by default in your vim:
https://github.com/vim/vim/tree/master/runtime/colors

If you want to try some without installing any plugins or anything, just do e.g. :colorscheme evening and see how they look. If you type :colorscheme <CTRL-D> you’ll be shown which colorschemes are available.

Answered By – nickspoon

Answer Checked By – Dawn Plyler (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.