What files do I need to create? What should be inside these files? Is there a default colorscheme file somewhere that I can use and change color values accordingly?
First, Vim looks in its runtime folders for a
colors directory. Here is where all the colorschemes should be stored (
This means you will need one file that lives in the
~/.vim/colors folder. Default colorschemes are located in
$VIMRUNTIME is usually
/usr/share/vim/vim74 or the
/usr/local/share/vim/vim74 directories, depending on how Vim is installed (substitute vim74 for vim73 for Vim version 7.3)
Now to get to the fun part.
Creating a colorscheme
To get started with creating your own colorscheme, I highly suggest taking a look at the default colorschemes and experiment with modifying them.
So copy the default colorscheme from
$VIMRUNTIME/colors folder to your
~/.vim/colors folder. Name it something that distinguishes itself from the default colorscheme name. So if you copied the
desert colorscheme that comes with Vim by default, name the file as
default_mod.vim or something to that effect. Open up the colorscheme file and change the
let g:colors_name to also distinguish itself from the default colorscheme file. By convention, this should be the same as the colorscheme file name.
In the colorscheme, all you have to do is give the colors for
guifg (for terminal background, terminal foreground, gui background, gui foreground colors respectively) for the different built in highlight groups. To check out the list of highlight groups you can modify, check out
:help highlight-default. Optionally, you can also use the
gui attributes to specify that you want a highlight group to be bold or italic.
For example, this will set a green color for a String:
highlight String ctermbg=NONE ctermfg=107 guibg=NONE guifg=#95B47B
You can also use highlight links to link a highlight group to another group. This is useful if you want two highlight groups to be the same colors.
For instance, you could link the
diffAdded highlight group to the String highlight group defined above:
highlight link diffAdded String
Check out sites like Vivify. They basically let you graphically create or tweak a scheme and then download the necessary files.
So the usage of this tool is pretty straight forward: First you need to define different variables corresponding to the nomenclature of your colorscheme and of course to its actual content (How the colors should look, which groups you want to use, etc) it is pretty straight forward because the author wrote a lot of comments to help you. Then all you need to do is to give your customized template to erb and the tool will generate the right files.