How to Install Dracula Theme in Vim

Dracula is a nice syntax highlighting theme that makes code easier to read. In this tutorial, we will learn how to install it for use with the Vim editor.

 

Check Which Version of Vim You are Using

The first step is to check what version of Vim you are using as we will have to do something slightly different for version 8 or below.

 

vim --version

 

If you have Vim 8 or Below Do the Following

Make the directory ~/.vim/pack/themes/opt

 

mkdir -p ~/.vim/pack/themes/opt

 

Change directory to the ~/.vim/pack/themes/opt folder.

cd ~/.vim/pack/themes/opt

 

For Vim 8.2 and Beyond Do This

Make the directory ~/.vim/pack/themes/start

 

mkdir -p ~/.vim/pack/themes/start

 

Change directory to the ~/.vim/pack/themes/start folder.

cd ~/.vim/pack/themes/start

 

Clone The Dracula Theme

The next step is to clone the Dracula Theme repository from Github.

 

git clone https://github.com/dracula/vim.git dracula

 

Create a Vim Configuration File

Now create a configuration file if you don't have one.

 

touch ~/.vimrc

 

Edit the Configuration File

Now edit the above configuration file and add the following lines:

 

packadd! dracula
syntax enable
colorscheme dracula

 

Conclusion

That's it, your Vim will have the Dracula theme when you open it again.

 

Dracula Theme screenshot
theme vim install