Change the vim color scheme (theme)

Comments are difficult to see using the default vim theme so you may want to change it. Once you find a color scheme that you like you’ll probably want to set it as the default so it’s used each time you run the vi editor. To change your vim theme while working in the vi editor enter :colorscheme followed by a theme name

:colorscheme themename

.
To find the available theme names on your system enter :colorscheme followed by a Space and then Tab through the different themes

:colorscheme <Tab>

.

Continue tabbing through to see all available color schemes on your system. I prefer the elflord theme so I set it within my vim editor by typing

:colorscheme elflord

That takes care of the current vim session, but now I’d like to set it as the default every time I launch vim. To do this you have to edit the vimrc file. Normally this file is a hidden file located in your home directory

ls -al | grep .vimrc

If .vimrc is not in your home directory check /etc for vimrc (this one isn’t a hidden file)

ls -al /etc | grep vimrc

If vimrc is not in /etc you can try looking in /usr/share/vim for vimrc

ls -al /usr/share/vim | grep vimrc

Wherever you find it, copy it to a hidden file in your home directory.

cp /usr/share/vim/vimrc ~/.vimrc

Then edit the file in your home directory

vim ~/.vimrc

And set the default color scheme. I added the following line under “set ruler”.