Cover image for Let's learn Vim - Plugins

Let's learn Vim - Plugins

thetinygoat profile image Sachin Saini ・3 min read

First of all, I would like to apologize for the gap between this and last vim writeup, I got busy with university 😅. With that out of the way, let's learn about Vim plugins 🥳🥳

What are vim plugins?

Plugins and add-ons that enhance Vim functionality in some way.
For example, there can be a plugin that provides git support, or there can be a fuzzy finder plugin and many more (all these are real and we will look at each of them 😁)

Where to find these plugins?

There is this awesome site called Vim Awesome, there you can find all the plugins and explore what you like.

With all the trivia out of the way, let's start playing around with plugins!

Installing a plugin manager

Plugins in Vim are managed by a plugin manager. There are many out there but I like to use Vim Plug. The great thing about Vim Plug is it's fully compatible with Neovim and it's plug and play (no pun intended 😜). Let's install Vim Plug.
Note: I will be installing Vim Plug for Neovim if you want to use Vim, you can look at the github repo.

$ sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \

This will install Vim Plug on your computer.

Setting up Vim Plug

Now that we have installed it, let's tell Neovim to use Vim Plug. Open your config file ($HOME/.config/nvim/init.vim), and add the following line at the top.

call plug#begin(stdpath('data') . '/plugged')

call plug#end()

All your plugins go between these two lines.
And that's all! you've successfully installed and configured Vim Plug 🎉

Installing plugins

I'm saving major plugins for the future, but we will install some basic plugins to get started.

Install a theme

Choosing a theme is one of my favorite hobbies and I've wasted more time choosing one than I would like to admit. My current favorite theme is called Badwolf but you can choose your own from Vim Awesome.
Once you have chosen a theme it's time to install it. On the theme page select Vim Plug as your plugin manager and copy the command to init.vim.
Alt Text

Your config file should look like this.

call plug#begin(stdpath('data') . '/plugged')

" => Badwolf color scheme
Plug 'sjl/badwolf'

call plug#end()

Save the config file using :w and source it, using :source %, this tells Neovim to update the config file it has read, as config file is read only once when you start this, this is a nice way to tell the editor that out config file has changed, update it.
This will update the config file, now let's tell Vim Plug to install the plugin using :PlugInstall, if you've set everything up correctly this should install the theme. You can now restart the editor to see the changes.

Install Airline

Airline is a status line at the bottom of the window, it's provides important information about the file nicely. Again we are going to use Vim Awesome for this.
Search vim-airline and the first result should be the one you are looking for. As usual add it to the config file, save it, source it and run :PlugInstall this will install all the newly added plugins.

Uninstalling a plugin

Uninstalling a plugin is pretty easy, just remove it from the config file and run :PlugClean it will remove all unused plugins.

This was a basic introduction to the Vim plugin ecosystem, there are tons of plugins for every use case and Vim Awesome is your friend, keep exploring!

If you like this article, consider following me on Twitter and Github, for more interesting stuff one Web Dev and software in general 😇

Posted on by:

thetinygoat profile

Sachin Saini


Currently a student, love to post about all things tech.


markdown guide