tl;dr:
- How do I override the colorscheme's cursor color in a highlight block
- How do I find a comprehensive list of colorscheme variables and how do I set them in general (to override a colorscheme's defaults)
I have been using Evan Schoonover's Solarized colorscheme (the dark mode) and absolutely love it. Except for one very annoying problem:
When incremental highlighting is on for /
and ?
searching, the cursor inside a highlighted block disappears:
In the picture, the search was /te
, so the highlight covers te
but the cursor is setting on the t
.
This is absolutely horrific for large scale search/replace n.
repeat operations. I can never quite tell where my current position is.
I am unsure if this problem is related to my terminal colors (I am using urxvt
with the Schoonover's solarized xresources theme and some minor adjustments (set the font, the scrollbar, etc), especially considering the fact that I have yet to see anyone complain of the same problem.
For further context: I am using i3wm
in Arch Linux
.
Even further context: I've been using neovim
for a while, but have never used a plugin manager, and the only 'plugin' I've ever used is this colorscheme (it just resides in my ~/.config/nvim/colors
directory).
Update
:verbose hi
verbose hi
SpecialKey xxx cterm=bold ctermfg=11 ctermbg=0 guifg=Cyan
Last set from ~/.config/nvim/colors/solarized.vim
EndOfBuffer xxx links to NonText
Last set from ~/.config/nvim/colors/solarized.vim
TermCursor xxx cterm=reverse gui=reverse
Last set from ~/.config/nvim/colors/solarized.vim
TermCursorNC xxx cleared
NonText xxx cterm=bold ctermfg=11 gui=bold guifg=Blue
Last set from ~/.config/nvim/colors/solarized.vim
Directory xxx ctermfg=4 guifg=Cyan
Last set from ~/.config/nvim/colors/solarized.vim
ErrorMsg xxx cterm=reverse ctermfg=1 guifg=White guibg=Red
Last set from ~/.config/nvim/colors/solarized.vim
IncSearch xxx cterm=standout ctermfg=9 gui=reverse
Last set from ~/.config/nvim/colors/solarized.vim
Search xxx cterm=reverse ctermfg=3 guifg=Black guibg=Yellow
Last set from ~/.config/nvim/colors/solarized.vim
MoreMsg xxx ctermfg=4 gui=bold guifg=SeaGreen
Last set from ~/.config/nvim/colors/solarized.vim
ModeMsg xxx ctermfg=4 gui=bold
Last set from ~/.config/nvim/colors/solarized.vim
LineNr xxx ctermfg=10 ctermbg=0 guifg=Yellow
Last set from ~/.config/nvim/colors/solarized.vim
CursorLineNr xxx ctermfg=11 gui=bold guifg=Yellow
Last set from ~/.config/nvim/colors/solarized.vim
Question xxx cterm=bold ctermfg=6 gui=bold guifg=Green
Last set from ~/.config/nvim/colors/solarized.vim
StatusLine xxx cterm=reverse ctermfg=14 ctermbg=0 gui=bold,reverse
Last set from ~/.config/nvim/colors/solarized.vim
StatusLineNC xxx cterm=reverse ctermfg=11 ctermbg=0 gui=reverse
Last set from ~/.config/nvim/colors/solarized.vim
VertSplit xxx ctermfg=11 ctermbg=11 gui=reverse
Last set from ~/.config/nvim/colors/solarized.vim
Title xxx cterm=bold ctermfg=9 gui=bold guifg=Magenta
Last set from ~/.config/nvim/colors/solarized.vim
Visual xxx cterm=reverse ctermfg=10 ctermbg=8 guibg=DarkGrey
Last set from ~/.config/nvim/colors/solarized.vim
VisualNC xxx cleared
WarningMsg xxx cterm=bold ctermfg=1 guifg=Red
Last set from ~/.config/nvim/colors/solarized.vim
I'm convinced it would be related to these:
TermCursor xxx cterm=reverse gui=reverse
Last set from ~/.config/nvim/colors/solarized.vim
TermCursorNC xxx cleared
IncSearch xxx cterm=standout ctermfg=9 gui=reverse
Last set from ~/.config/nvim/colors/solarized.vim
Search xxx cterm=reverse ctermfg=3 guifg=Black guibg=Yellow
Last set from ~/.config/nvim/colors/solarized.vim
CursorLineNr xxx ctermfg=11 gui=bold guifg=Yellow
Last set from ~/.config/nvim/colors/solarized.vim
Specifically the bits reading gui=reverse
seem highly indicative to me, but I am unsure, and also have no idea how to set them. I tried searching through the source file, and hacking at it, but couldn't get it to load properly.
Advice?
Update 2:
I have discovered the syntax and the (semiright) variable:
Search
is the variable that corresponds to the mode presenting my problem (IncSearch
regards as-you-type searching colors (different, apparently)hi Search ctermfg=<color>
changes the general color of the highlight.ctermbg
does nothing. The cursor seems out of the picture.cterm=underline
changes the highlighting mode to underline the selection, which properly changes the cursor color, but I would prefer to simply change the color of the cursor, not the mode of highlighting.
Will keep experimenting
Solved:
It seems that the nature of the problem is simply the setting of Search cterm=reverse
and because of the nature of that specific setting, this is an impossible problem. ((Does no one else experience this?))
Scratch all that: solved the problem.
Search xxx cterm=reverse ctermfg=3 guifg=Black guibg=Yellow
Last set from ~/.config/nvim/colors/solarized.vim
essentially says to reverse the color scheme. I found that setting ctermbg did nothing for the cursor color. This was frustrating. I still don't fully understand why, if the colors are simply reversed setting ctermbg wouldn't solve the problem. Solved it anyway with a (seemingly hacky?) workaround
- Turn off
cterm=reverse
- Set
ctermbg
to the former value ofctermfg
(3) - Set
ctermfg
to something sufficiently high contrast to read the highlighted text (it needs to be dark; I went with 8).
Command: hi Search cterm=none ctermbg=3 ctermfg=8
The cursor becomes the color of normal unhighlighted text. This makes it visible. Setting the no reverse causes the highlighted text to be difficult to read, so the ctermfg
corrects that.
I'm going to leave the answer open to someone with more understanding, who might expand on this subject for future readers. If no one answers in the next week, I'll just post this section as an answer and accept it.
verbose hi
would help. Please add the relevant details to your question. You could also read the source and try to find the right groups/definitions.