Vim is a text editor that can be used to edit all kinds of plain text, especially useful for writing and editing programs. It is also one of the customizable text editors heavily used in Linux operating system.
The suitable color in the editor helps you to categorize, analyze and identify bug in the code. You can change color schemes that come with the software package or install vim themes.
We are going to use and set Vim color schemes in centos 7 or 8. Though the tutorial is prepared on centos 8, the procedure is same for all the Linux distribution.
1. Vim text editor
The minimal version of CentOS doesn’t come up with vim. You need to install it.
sudo yum install -y vim
2. Terminal or ssh access to your server
View and change default color scheme
By the default installation, there are a number of vim color schemes. Vim color schemes are installed in the /usr/share/vim/vim*/colors directory.
To see a list of ready-to-use themes, open any document using the Vim editor, use:
:colorscheme [space] [crtl+d]
For instance, to switch to the color scheme darkblue, you would use:
Download and apply themes
Themes are basically a mixture of different colors which has a nice feel and look. There is a wide variety of color themes that may suit your needs. You can find and download Vim themes from GitHub or websites such as vimcolors.
In the following steps, we are going to download nirvana color scheme and use it.
1. First find folder where vim color scheme are stored during installation.
$ sudo find / -iname colors
The color are stored inside the directory /usr/share/vim/vim74/colors/
2. Download nirvana from its github page.
$ sudo yum install –y git $ git clone https://github.com/duckwork/nirvana.git
3. Move the scheme configuration to /usr/share/vim/vim74/colors/
$ sudo mv nirvana/colors/nirvana.vim /usr/share/vim/vim74/colors/
4. Open any file and just search for nirvana, use:
To make this change permanent, update .vimrc file in /etc or in the user's home directory.
Change below the line with your preferred color scheme name:
To enable the syntax highlight, use:
A color scheme can dramatically influence your experience with any text editor. This tutorial guide you to choose and apply colors in vim and accomplish your task in an easier way.