📜 ⬆️ ⬇️

Color Schemes in Vim

There is so much written about vim that it’s hard to imagine that some topics were left unlighted. But there is no ... There is something written quite a bit. Fill in the gap. I hope that this article will be pleasant to the sims and vimanoids.

Speech in this article will focus on color schemes. Vim supports syntax highlighting for a wide variety of files, ranging from all sorts of configs, to programming languages ​​(including rather rare ones).
There are quite a lot of color schemes for vim (a rather large collection is found here ), but to put it mildly it strains the eyes and amazes with its senseless diversity, and among the relatively ergonomic themes with the right color selection often another problem appears. The problem is that the authors use their color schemes with a small set of files.
Someone writes code in C, its color schemes remarkably display the source texts, and when you try, for example, to edit html, strange colors appear or the text becomes invisible in places. Another problem is that different plug-ins use different elements of the color scheme and sometimes there are rather annoying color collisions. So a pretty good ego scheme when installing popular plugins NERDTree and Tagbar gives annoying red and pink color in the headers.
image
And this, by the way, is quite old and neatly made by the scheme — often simply the author cannot check all the colors in advance for all possible cases.
Manual editing of color schemes is quite time-consuming - you first need to figure out which variable is used to encode the element. Then you need to find the appropriate color and set its code in RGB format. After that, you need to set the color scheme for vim and see the result. To solve this problem, there are several options.
First is the ColorSchemeEditor plugin. It requires building vim with the python programming language support and installing pygtk. For Linux OS, as a rule, python and pygtk are usually present on installation dvds or are easily found in repositories, as for the Windows XP / Vista / 9 OS family, then there is generally no problem - you just need to install the necessary installation packages from the developer sites.
With this plugin, you can change colors and see all changes at once in the Vim window.
image

Thus, creating or correcting a color scheme becomes an interactive process.
With the help of this plugin, I quite easily corrected the annoying color flaws of the ego scheme and spent no more than a couple of minutes on this. I did not have to read the syntax description for specifying colors, I simply replaced the unfortunate color and saved the scheme in a new file.
image
Another way to create color schemes is the VimTax web service. This is quite a graphics editor in the browser. The main disadvantage of this service is that it is impossible to load your color schemes for editing. The basis can be taken only standard schemes that are already stored on the site. But the process of creating a color scheme is quite obvious - you can choose a design element, set the color and immediately see the result.
In general, the correct selection of compatible colors has long been implemented in the form of algorithms (an example of the work of such algorithms is http://www.colorjack.com/sphere/ ). Therefore, if an artistic result is not needed, then a generator of colors compatible with each other can be just the solution.
Sweyla's Color Theme Generator is the very “autopilot” that can randomly generate color schemes for vim (and not only, but also for emacs, etc.). You can play around a bit and choose one of the random topics. Maybe they will not be too original, but the preservation of vision and more or less readable look will be guaranteed.

Links to resources on vim color schemes


VimTax -A GUI to make your non-GUI editor all pretty and stuff.
http://www.vimtax.com/
Convenient editor of color schemes in the form of a web-service.
')
Sweyla's Color Theme Generator
http://themes.sweyla.com/
Randomly generates color schemes.

Vim Color Scheme Test.
http://code.google.com/p/vimcolorschemetest/
A large collection of topics and demonstration.

ColorSchemeEditor
http://code.google.com/p/vimcolorschemetest/
Color scheme editor plugin (python + gtk)

And one more link is not about vim, but to the color matching service.
http://www.colorjack.com/sphere/

Source: https://habr.com/ru/post/134194/


All Articles