[HowTo] Change theme in vim

This is a walkthrough on how we can change the color theme in vi.

Basically Colortheme in vi are placed in ~/.vim/colors folder by default. This path is configurable through vi configurations. For this post, I assume the folder is “~/.vim/colors”. We’ll use 256 color enabled color theme. So you’ll also need to enable 256 color for your terminal editor.

Enable 256 Color mode in vi.

$ vi ~/.vimrc

Enter “set t_Co=256” and save it.

set t_Co=256

On next start of VI it will load at 256 colormode. If somehow you can’t see any change in colormode, try to find ways to enable 256 color mode. For this post, we’ll use “http://vimcolors.com/390/tayra/dark” theme.

Create “~/.vim/colors” folder if it doesn’t exits. Then use below command one by one.

$ cd ~/.vim/colors
$ git clone https://github.com/the31k/vim-colors-tayra.git tayra
$ cp tayra/*vim .

All we did was cloned “tayra” theme from git then copied over everything from tayra folder with .vim extension to the “~/.vim/colors” folder. Now to test it open vi and use the following command to test it.

$ vi ~/.vimrc

One inside vi type “:colorscheme tayra” it should change the current theme to “Tayra”.

Now, you can look for new themes in vi and come to love the one you love.

Samundra Shrestha

Fullstack Developer, Senior Software Engineer

Leave a Reply

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