≡ Menu

vim-plug: A beautiful and minimalist vim plugin manager for Unix and Linux users

A vim plugin manager is a must for any die-hard vim user. You can find a few option available out there. My personal favorite is vim-plug which is a beautiful and minimalist plugin for vim. Let us see how to install and use this plugin on Linux or Unix-like system.

Installation

Naturally, you must have vim installed on your system. For demo purpose I am using Ubuntu and MacOS. Simple download plug.vim and put it in the “autoload” directory:
$ mkdir ~/.vim/autoload/
$ cd ~/.vim/autoload/

Let us grab the plug.vim either using wget command or curl command:
$ wget https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
OR
$ curl -O https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

How do I configure vim-plug?

The syntax is as follows in ~/.vimrc:

" Specify a directory for plugins 
call plug#begin('~/.vim/plugged')
 
" Any valid git URL is allowed for plugin
Plug 'valid git URL'
 
" Shorthand notation for plugin
Plug 'foo/bar'
 
" Initialize plugin system
call plug#end()

Example

Let us say you want to use a vim plugin named ansible-vim for syntax highlighting Ansible’s common filetypes. You need to append the following in your ~/.vimrc file:

call plug#begin('~/.vim/plugged')
Plug 'pearofducks/ansible-vim'
call plug#end()

Save and close the file.

Install ansible-vim plugin

Start the text editor:
$ vim
To see status type type:

:PlugStatus

To install ansible-vim type:

:PlugInstall

Sample session:

Animated gif 01: Vim-plug in action

Animated gif 01: Vim-plug in action


To update plugins type:
:PlugUpdate
To ugrade vim-plug itself type:
:PlugUpgrade
Of course, if you are happy with vundle or pathogen, then no need to switch. However, I liked this one better. For more information see the official GitHub repo.

Share this on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 2 comments… add one }

Leave a Comment