Introduction to Vim Plugins

Mike Hartington
InstructorMike Hartington
Share this video with your friends

Social Share Links

Send Tweet
Published 8 years ago
Updated 4 years ago

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 .vimrc

[00:01] 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.

[00:13] 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.

[00:28] 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.

[00:48] 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.

[01:05] So, [inaudible] 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.

[01:23] Now we can save and quit Vim, start the editor back up again, and execute plug install.

[01:29] 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.

[01:46] 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.

[01:59] 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.

egghead
egghead
~ 32 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today