Set and Change Color Schemes in Vim: A Step-by-Step Guide

Color schemes are an essential aspect of customizing the visual appearance of Vim. In Vim, a color scheme is a configuration that determines the colors and formatting used to represent different syntax elements within the editor. These elements include keywords, comments, strings, functions, and more. Color schemes define the foreground and background colors, as well as additional attributes like bold, italic, or underline.

By applying a color scheme, you can transform the visual appearance of Vim, making it easier to differentiate between various code elements and improving overall readability.

In this blog post, I will show you how to set the default color scheme as well as a custom color scheme as a Vim plugin.

Enabling termguicolors

Termguicolors enable 24-bit RGB color values for a more extensive and accurate range of colors in the terminal. This allows color schemes to have richer and more vibrant colors, enhancing the visual experience of your Vim editor.

To enable termguicolors, open your ~/.vimrc file:

vim ~/.vimrc

Then add the following line to the vimrc configuration file:

syntax on               " enable syntax highlighting
set termguicolors       " enable true colors
set t_Co=256            " needed to work in the Ubuntu terminal

Setting Vim’s Built-in Color Scheme

By default, Vim comes with several color schemes that can be used without installing any plugins.

Here are the default color schemes in Vim:


You can set any of these color schemes with a simple Vim script. To set a color scheme in Vim, open any file with Vim and enter the following command:

:colorscheme <color_scheme_name>

???? Setting the colorscheme in this way is not persistent, meaning that Vim will not remember the previous colorscheme when you open a new file.

Installing Color Schemes with Vim Plug

Vim Plug, a popular plugin manager, simplifies the installation and management of color schemes in Vim. Before installing a color scheme with Vim Plug, you need to install Vim Plug on your system. If you haven’t installed Vim Plug yet, consider following our comprehensive guide on How to Install Plugins in Vim with Vim-Plug.

Alternatively, you can execute the following command in the terminal to install Vim Plug:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \

After installing Vim Plug, restart Vim or enter the following command to apply the changes:

:source $MYVIMRC

There are many color schemes available for Vim to choose from. You can find popular color schemes on the Vim Awesome website.

Let’s say you want to install the popular Nightfly color scheme for Vim. Open your Vim configuration file:

vim ~/.vimrc

Add the following lines to your configuration file:

call plug#begin('~/.vim/plugged')

" List your color scheme plugins
Plug 'bluz71/vim-nightfly-colors'
Plug 'NLKNguyen/papercolor-theme'

" End Vim Plug setup
call plug#end()

Save the configuration file and exit. Relaunch Vim and run the command :PlugInstall. Vim Plug will download and install the specified color schemes.

Once the installation is complete, restart Vim. To activate a specific color scheme, enter the following command in Vim:

:colorscheme nightfly
nightfly colorscheme for vim

Setting Vim’s Color Scheme Permanently

If you want to persist the color scheme setting, you can use a Vim script to set the color scheme permanently. To set the color scheme, open the ~/.vimrc file with the following command:

vim ~/.vimrc

Then add the following line to the bottom of the file:

colorscheme nightfly

Replace nightfly with your desired color scheme. Save and quit the file. Now, when you open any file with Vim, you will see that your desired color scheme is applied.


Color schemes allow you to personalize your terminal with your favorite colors. Setting a color scheme is one of the fundamental things in Vim. In this blog post, I have shown you how to set a color scheme in Vim, from basic to advanced. I have also shown you how to handle errors when a color scheme is not found. If you have any confusion, feel free to let me know in the comment section.

Share your love

Newsletter Updates

Stay updated with our latest guides and tutorials about Linux.

Leave a Reply

Your email address will not be published. Required fields are marked *