In vim, I want to:
- highlight a single line (e.g.
:hi CursorLine ctermbg=black)
AND
- maintain syntax highlighting
AND
- not set up any custom color themes or similar
(note: adding a few lines to .vimrc is fine)
I've tried setting via :hi CursorLine ctermbg=black, but this results in changing the cursor highlight color but not maintaining syntax coloring.
not highlighted, and has syntax coloring:
highlighted, but loses syntax coloring:
in above example, I would want the string word to stay purple, if word stay yellow, etc., even though line is highlighted.
I also tried toggling :syntax off :syntax on, and not surprisingly this had no effect.
This question (Syntax highlighting in vim) seems similar to what I'm asking, but it's not because 1) I don't want to change the background, 2) I don't want to change theme, 3) it seems like OP here was having trouble with existing syntax color scheme and just wanted to be able to see things.
This question (Custom syntax coloring vim) seems similar to what I'm asking, but it's not because 1) I don't want to change existing syntax coloring, I want to keep it, 2) I don't want to add arbitrary syntax highlighting, I just want CursorLine to be highlighted while also maintaining syntax coloring.


:hi CursorLine? Are the other attributes cleared? If not, you can clear them by setting them to NONE, e.g.:hi CursorLine ctermfg=NONE. Or if you havecterm=reversethen you're actually setting the foreground color withctermbg... Reset that withcterm=NONEtoo. - filbranden:hi CursorLineand gotCursorLine xxx term=underline cterm=underline guibg=Grey40. I then solved this by doing:hi CursorLine ctermbg=black term=none cterm=none. Not exactly what you said, but that pointed me in the right direction, so thanks! - superswellsam