When I open the terminal, go to preferences and then to colors, I can change most colors, but there's one that I can't seem to change.
Here's what it looks like in a java file:
The only time I see this color is when I'm editing a file in Java, C, or C++ (I'm sure it shows up for files in other languages, too). All keywords related to classes, objects, or variables show up in this color (see the image linked above).
Is there any way I can find out where the value for this color is stored and change it? If it matters, I use vim
.
How tokens are highlighted in
vim
depends onvim
's effective color scheme and on the current language.There are many degrees to which the effective color scheme for the current language may be altered; I'm going to describe how to make small adjustments to the effective color scheme for a specific language and for the default theme, for a single user, as that's probably the most common scenario.
First off, you need to determine which syntax group the token you want to change belongs to; open a file in your target language using
vim
, place the cursor on any character of the token (in this case, e.g., on eitherp
/u
/b
/ ... inpublic
) and run:This will output the syntax group's name of the current token (in this case:
Type
).You'll also need to figure out the filetype of your target language:
This will output the current filetype of the current file (in this case:
java
).Next, you'll need to tell
vim
to highlight theType
syntax group injava
files using a different color.First, create a directory to store overrides to syntax rules:
Pick a 256-color-terminal-compatible color, then create a file named the same as the filetype +
.vim
(in this case,java.vim
):Finally, add this line to the file, replacing
196
with the color you picked:This is the outcome when overriding
sub
s' names in Perl (note how thefoo
token changes from cyan to red); before:after: