I just switched to iTerm2 on macOS and found some of its options go to Vim as well. That's the case for fonts, I was able to select a Vim font that I like from iTerm options.
It seems iTerm color options also apply to Vim highligh. But in this case highlight situation is not good enogh for my taste. So I tried to change:
:hi Comment ctermfg=gray
Changes font color of comments.
I would like to change =
, ::
, +
, -
color, I think these are Operators, so I tried:
:hi Operator ctermfg=blue
But it seems nothing changes. How should I do that?
If it matters I'm playing with .cpp/.h files.
The =
, +
, -
, etc. are not defined as Operator
in
the default C syntax, which C++ inherits from. Usually
Operator
means keywords like sizeof
, typeof
, and so
on.
Since you describe your terminal settings "leaking" to Vim,
it's very likely that your colorscheme is not defining the
ctermfg
and bg
. Either for a custom matched Operator
group or for Normal
(most likely). You can test that
easily by setting Normal
to some color, like in your
example:
:hi Normal ctermfg=blue
If the +
et all changes, sure they are not in fact being
matched as Operator
. To fix it, if you agree on setting
your Normal
group color then that's all there is to it —
Normal
is the group for default text, unmatched syntax
elements. When your colorscheme does not set it, it will use
the terminal colors.
If however you want to have the operators in a different and
exclusive color, you will need to match them manually by
defining a new syntax item (:h syn-define
).