The vim editor can take advantage of color schemes to help emphasize specific elements of code.
Adding a theme
First make sure you have vim installed and not just vi. You can test this by typing ‘vim’ at the command line and see if the editor loads.
Add the following to ~/.vimrc to make desert the default theme.
|
After restarting your shell (logout and login again again) your vim sessions will have the desert color scheme. Desert is the scheme that’s pictured at the top of this article. Some other stock themes are:
- blue
- delek
- evening
- murphy
- slate
- darkblue
- desert
- koehler
- pablo
- ron
- torte
- default
- elflord
- morning
- peachpuff
- shine
- zellner
Modifying a theme
If you want to change just a specific color in a theme you can do so by editing the theme itself. For instance if we want to change the comments in the desert theme to green we can do the following.
Edit /usr/share/vim/vim73/colors/desert.vim
Search and replace the following two lines so they now say green:
|
Adding even more themes
Tired of the default themes? Need something more? Try some of these other themes:
http://www.vimninjas.com/2012/08/26/10-vim-color-schemes-you-need-to-own/
https://github.com/morhetz/gruvbox
Other vim settings I use
Unrelated to color themes but related to vim settings. Here are the other settings in my ~/.vimrc file.
|
Comments