Skip to content

June Gunn Posts

Vim-plug: a Vim plug-in manager

Vim is one of the most popular code editors used by many since Vim is found in most Unix systems (this includes Linux) it is one of the great options that programmers and system administrators tend to use.

This editor is very complete and above all very versatile as it has great features that make it a great option to use. Although natively many would discard the use of Vim is because they do not know the great potential it has to be customized to our needs.

About Vim

Among the features that we can highlight of Vim we find:

  • Integrated spell checker
  • Text autocompletion
  • Tabbed navigation
  • Multiple windows, which divide the editing area horizontally or vertically.
  • Syntax highlighting depending on the programming language or tags used.
  • Undo and redo commands
  • Understanding of more than 200 different syntaxes
  • Scripting language for programming extensions
  • Command, word and filename completion
  • Compression and decompression of files, making it possible to edit compressed files
  • Recognition of file formats and conversion between them.
  • History of executed commands
  • Macro recording and playback
  • Saving of the configuration between sessions
  • Automatic and manual code folding
  • Optional graphical interface

What makes Vim interesting is that it is highly configurable and customizable so the use of plugins in it can be possible.

These plugins had to be downloaded manually distributed as tarballs and extracted into a directory called ~/.vim.

Handling plugins in this way is not a problem at first glance, but when too many were used it could result in a big mess, since all the files for each plugin were concentrated in a single directory.

This is where Vim’s plugin managers come in handy. Plugin managers keep the files of installed plugins in a separate directory, so it is very easy to manage all the plugins

Vim-plug is a minimalistic, open source and free vim plugin manager that can install or update plugins in parallel.

It creates clones to minimize disk space usage and download time. Supports on-demand plugin loading for faster startup time.

Other notable features are branch support, tag, link, post-update, support for externally managed plugins, etc.

How to install Vim-plug on Ubuntu 18.04 and derivatives?

If you are Vim users and want to install this plugin manager you should open a terminal and execute the following commands.

We open the terminal with Ctrl + Alt + T and we will install a dependency with:

sudo apt install curl

Now we are going to execute:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Done this now we must add vim-plug to our ~/.vimrc file, let’s add the following:
call plug # begin (‘~ / .vim / plugged’)

Plug ‘itchyny / lightline.vim’

call plug # end ()

We save and reload the file. vimrc and with that the administrator will be installed in our system.

How to use vim-plug?

We must open the editor with:

vim

To start using vim-plug we do it in the following way, to check the status of the plug-ins

PlugStatus

To install plug-ins:

PlugInstall

Install or update plug-ins:

PlugUpdate plugin name

If we want to delete unused directories:

PlugClean[!]

To update the vim-plug manager:

PlugUpgrade

Generate script to restore current snapshot of plugins.

PlugSnapshot

Sometimes, upgraded plugins may have new errors or stop working properly.

To fix this, you can simply undo the problematic plugins.

Type the command:

PlugDiff

To review the changes since the last

PlugUpdate

And return each plug-in to the state before the update by pressing X in each paragraph.

It is up to each one how to use this Vim plugins manager in the system, as mentioned Vim can be enhanced and customized to our needs.

If you want to know more about this tool you can visit the following link.