If you look at code all day, having readable colors is going to be the biggest thing that saves your eyes. Here’s how I tweak my colors any time they bother me. To start, you’ll need this little piece of script, which gives you a ,hi alias, which will display the current highlight group.
1. With your cursor over the thing that’s highlighted in a bad color, hit the ,hi. Say I don’t like the way this describe keyword is done in pink:
Image may be NSFW.
Clik here to view.
2. Note the info displayed in the status line, it will look something like:
hi<rspecGroupMethods> trans<rspecGroupMethods> lo<Todo> FG:#d33682
These are the color highlight groups, in brackets. The leftmost one is the one with highest precedence, and the one we want to override.
3. Look at the list of available colors using :hi. Note the names of the groups on the left, and their displayed colors. Find one you like. The list will look something like this:
Image may be NSFW.
Clik here to view.
4. Create a link between the group you want to modify and the one you like. Let’s say the one I like is Identifier, and the group I’m modifying is MatchParen. I would link them like this:
hi! link rspecGroupMethods Type
Reload your vimrc, or the file in which you placed the statement. The easiest way to evaluate the current file is :so %. And voila:
Image may be NSFW.
Clik here to view.
You can place this in your ~/.vimrc, or in a subfile under ~/.vimrc/plugins. If you liked this example, be sure to check out my highly customized dotfile project called YADR, which offers the ,hi functionality, well organized vim snippets and plugins, and other handy shortcuts to save you tons of time.
The post How to change vim syntax colors that are annoying you appeared first on Yan Pritzker.