Vim has the ability to extend its functionality through plugins that can be installed either manually or through plugin managers. We'll setup the vim-plug manager to install plugins for our
Vim's scripting ability allows you to use external files to enhance the Vim's functionality. To add plugins, you can either manually add them to your file system, or you can use a plugin manager to automate it.
In our case, we'll use the Vim-plug plugin manager. Vim-plug gives us a simple way to declare what plugins we want to load, to allow in session through Git, and then reload the editor with the plugins added.
Vim-plug does have a few requirements, so be sure to read over the documentation for your platform. To get started, we'll first need to copy the Vim-plug script into our .Vim directory. With that installed, let's open r.mrc and add a few lines to the file.
We'll add call plug begin, and then say a directory where we want our plugins to be installed. Then we'll add plug and tell Vim-plug that we're done trying to load any plugins.
So, [inaudible 1:05] will add a simple plugin, Vim sensible, which just sends a bunch of normal defaults for us. We'll use the command plug and give it the GitHub user name, and then the repo we want to load. In this case, we're loading a repo from tpope and his plugin, Vim sensible.
Now we can save and quit Vim, start the editor back up again, and execute plug install.
We'll get a small window on the left saying that we're installing the plugin. As soon as the plugin installation is done, Vim will update and we'll have the plugin running. We'll enter command mode, and use the command exit to close the installation window.
We can take this a step further with a few additional lines of Vim script. This autocommand will run whenever Vim starts. If there is a missing plugin, it'll run the command, plug install, and then install whatever is missing.
We'll add a new plugin to test it out. As you can see, the plugin installed without us having to enter anything, and then the window was closed as soon as it was done.