I've spent a bunch of time going over my Vim and Tmux configurations lately, trying to refine my workflow and I have come across a (small but annoying) problem that is stumping me. I am currently using OSX, but I have had the same issue with Windows' terminal/powershell.
My issue is that I am unable to change the brown
color that appears in the default vim syntax highlighting which is used many of the languages that I write in. The color that I am speaking of can be seen in this vim colortest:
In the default OSX terminal (and in powershell) you can set the ANSI colors via terminal preferences, however, the brown
color is not included in the GUI configuration options. This results in some ugly syntax highlighting that does not fit in with my desired color scheme:
My question is, what is the most portable way to change this default color? I would love to be able to do something in my .vimrc
that would just work around this ugly color so I don't have to reconfigure colors for any system that I might be on, but I understand this might not be possible. Another route would be changing the syntax highlighting colors, but my investigations into that have so been unfruitful.
Thanks!
Appedix: Colors selected in OSX profile for screenshots:
CodePudding user response:
Sadly, the default Vim colorscheme is not as tidy as one would hope. In this case, Brown
is a bit of a "catchall" name that ends up being interpreted differently in different contexts.
- In GUI Vim,
Brown
refers to the "Brown" in X11'srgb.txt
:#A52A2A
. - In TUI Vim with
&t_Co == 256
, you get#af5f00
, AKA130
in the "xterm palette". - In TUI Vim with
&t_Co == 16
or&t_Co == 8
, you get your terminal palette's "Yellow", AKA3
.
By the looks of it, you seem to be affected by the second case.
While there exist ways to change the so-called "xterm palette" wholesale, you will have a hard time changing that specific color in a straightforward, non-messy way.
What you can do…
- Do
:set background=dark
to force Vim to use a different set of default colors that doesn't include "Brown". - Choose a built-in or third-party colorscheme that doesn't use that specific color.
- Override the
Statement
highlight group as explained in this gist with whatever color you want from the xterm palette.