33.5 vim Plugins: vim-plug and Popular Plugins
Right, so you’ve survived the initial vim gauntlet. You can exit without a system reboot. Congratulations. But let’s be honest: vanilla vim is a bit like a perfectly good, yet unfurnished, apartment. The walls are up, the plumbing works, but it’s missing the bookshelves, the good lighting, and the espresso machine that makes life worth living. Plugins are how we install that espresso machine.
Now, you could copy plugin folders into your ~/.vim directory and mess with runtimepath like some kind of medieval peasant. But we live in the 21st century. We use a plugin manager. And while there are several, vim-plug is my weapon of choice because it’s stupidly simple, powerful, and just gets out of your way.
Installing vim-plug: The 30-Second Operation
This isn’t a ceremony. We’re not summoning a demon. We’re downloading a single file. The vim-plug install script essentially just ensures that ~/.vim/autoload/plug.vim exists and is the right file.
For Unix-based systems (Linux, macOS), run this in your terminal:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
For Windows, if you’re using git bash or WSL, the command is almost identical, just with a different home path:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
(If you’re stuck in a pure Windows environment with no Unix-like shell, God help you, but the vim-plug GitHub page has instructions.)
Now, crack open your ~/.vimrc file. This is where the magic happens.
Configuring Your .vimrc for Plugins
You need to add a block delimited by plug#begin() and plug#end(). Any plugins you list between these calls will be managed by vim-plug. The plug#begin() call can take an argument—a directory where plugins will be installed. I highly recommend specifying one to keep things tidy. Here’s the skeleton:
" ~/.vimrc
call plug#begin('~/.vim/plugged')
" Your plugin list will go here. Example:
" Plug 'junegunn/vim-easy-align'
call plug#end()
The string after Plug is almost always the GitHub repository URL minus the https://github.com/ part. This is why it’s so popular; it’s dead simple.
Actually Installing the Plugins
Here’s the first “gotcha” that trips everyone up. You don’t install plugins by saving your .vimrc and restarting vim. You have to tell vim-plug to go fetch them. Save your .vimrc, then restart vim or just source it (:source %).
Now, run :PlugInstall. This command will clone all the plugins you’ve listed into the directory you specified (~/.vim/plugged), and it will manage them for you. You’ll see a nice little status window pop up showing the progress. That’s it. They’re installed.
Essential Plugins to Get You Started
You could go down a rabbit hole here, but let’s start with the non-negotiables.
A Color Scheme That Doesn’t Induce Eye Cancer:
Vanilla vim color schemes are… functional. Let’s fix that. gruvbox is a popular, easy-on-the-eyes choice.
call plug#begin('~/.vim/plugged')
Plug 'morhetz/gruvbox'
call plug#end()
Now, add this line after the call plug#end() line to actually set the scheme:
colorscheme gruvbox
A File System Explorer: NERDTree
The built-in :Explore is fine, I guess, if you enjoy navigating a file tree that looks like it was designed in 1987. NERDTree gives you a proper, familiar sidebar file explorer.
Plug 'preservim/nerdtree'
Map a key to toggle it open and closed. I use Ctrl-n because I’m unoriginal. Add this mapping to your .vimrc:
nnoremap <C-n> :NERDTreeToggle<CR>
Fuzzy Finding: fzf.vim
This is the killer app. Blazingly fast file searching. It’s not just a plugin; it’s a dependency. You need to install the fzf binary outside of vim first (brew install fzf on macOS, apt install fzf on Debian/Ubuntu), then the vim plugin integrates with it.
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
The best way to invoke it is with :Files. Map it to something sensible. I live with Ctrl-p:
nnoremap <C-p> :Files<CR>
Managing Plugins: The Other Commands
vim-plug isn’t just for installation. Its real power is in management.
:PlugUpdateupdates all your installed plugins. Run this weekly.:PlugCleanremoves any plugins you’ve deleted from your.vimrclist. It will ask for confirmation before nuking the directories. This is how you keep your plugin folder clean.:PlugUpgradeupgradesvim-plugitself. Meta.
The Golden Rule: Restraint
The most common pitfall is turning vim into a bloated IDE that takes 5 seconds to open a text file because you’ve installed 150 plugins. Every plugin is a trade-off: functionality for startup time and complexity. Be judicious. Install plugins to solve specific problems you actually have, not because some blog post told you to. Start with the basics above, use vim for a week, and see what annoys you. Then go find a plugin to fix that specific annoyance. Your .vimrc should be a curated toolset, not a hoarder’s collection of every shiny thing you found.