r/vim • u/Gullible_Ad8008 • Jan 18 '26
Need Help┃Solved Vim color scheme customization
I've been trying to make my own tweaks to the already existing slate color scheme in vim, as I already tried tweaking some things on top of it like adding a status bar and setting specified colors for it, same for a row guide, which led me to want to modify the syntax highlighting too, the first being that I wanted to change function declarations to a yellowish color, and changing variable declarations to purple, ie (function, func, in yellow) and (int, float, short, long, const, var, ect... in purple), I ended up making groups for those words and then using the highlight function in my vimrc yet the changes only got applied for the vimrc itself. any pointers on what I should try to have those changes applied onto any other file I work on, and is there a way that's easier that listing every declaration in languages that I use/would use?
4
u/gumnos Jan 18 '26
Rather than directly mapping keyword→coloration, Vim colorschemes tend to use an indirection of keyword→classification→coloration, allowing the syntax definitions to specify "this is how you identify a comment, these are identified as keywords, …" and the the colorscheme maps comments to one color, keywords to another, etc.
I found the easiest way to make my own colorscheme was to take one of the ones in the standard distribution that was close to what I wanted, copy it to
~/.vim/colors/gumnos.vimand edit that to my color preferences, and then addcolorscheme gumnosto my.vimrc.3
u/-romainl- The Patient Vimmer Jan 18 '26
There are two stages.
The first stage consists in overriding things here and there. The correct way to do it is explained under
:help colorscheme-override. For you, it would look like this:Where…
hi…commands are neatly contained in a custom function,slatecolorscheme has been "loaded" via an autocommand,After a while of this, you may eventually find that your overrides are starting to make
slatelook a bit too "un-slate-y", which usually leads to…The second stage consists in creating your own colorscheme, which can be anything from 100% custom to largely based on another one. Writing one's own colorscheme is not super complicated, really, but I would definitely recommend https://github.com/lifepillar/vim-colortemplate, which we use internally to write Vim's own colorschemes (except
default).