The Vim Plugin Ecosystem
Vim Intermediate/Advanced
Chapter 5 — The Vim Plugin Ecosystem
Why Plugins, and Why Carefully
Learning Vim's Configuration chapter covered your .vimrc — settings that adjust Vim's existing behavior. Plugins are a different kind of extension entirely: they can add genuinely new commands, new text objects, even new operators, none of which exist in Vim by default. This chapter covers the traditional, vimscript-based plugin ecosystem (usable in both classic Vim and Neovim); Chapter 6 covers Neovim's own Lua-native tooling specifically.
Plugin Managers — vim-plug
vim-plug is one of the most widely used plugin managers — a single vimscript file, installed once, that then handles downloading and loading every plugin you declare:
# install vim-plug itself (run once, from a terminal):
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Plugins are then declared inside your .vimrc, between a matching plug#begin()/plug#end() pair:
" .vimrc call plug#begin() Plug 'junegunn/fzf.vim' Plug 'tpope/vim-surround' Plug 'tpope/vim-commentary' call plug#end()
:PlugInstall # installs every Plug declared above, not yet on disk :PlugUpdate # updates every installed plugin to its latest version :PlugClean # removes any installed plugin no longer listed in .vimrc
A Curated Set of Essential Plugins
fzf.vim
Fuzzy file finding and searching, via :Files (jump to any file by a few letters of its name) and :Rg (fuzzy-filter live grep results) — genuinely transformative for navigating a large project.
vim-surround
Adds commands for adding, changing, and deleting the delimiters around text — a direct extension of Chapter 3's text objects, covered in detail below.
vim-commentary
Toggle line comments with gcc (current line) or gc plus any motion — correctly using whatever comment syntax the current filetype expects.
A file tree (e.g. NERDTree)
A persistent sidebar file explorer — considerably richer than Vim's built-in netrw, closer to the Explorer sidebar from the site's own VS Code course.
vim-surround in depth
This is the plugin most worth understanding well, because it builds directly on Chapter 3's i/a text-object model rather than introducing an unrelated one:
cs"' # Change Surrounding: double quotes -> single quotes ds( # Delete Surrounding: remove the enclosing parentheses, keep the content ysiw) # You Surround: wrap the inner word (Chapter 3's iw) in parentheses
# before: say(hello) cs(< # change surrounding ( to < # after: say<hello>
ysiw) reads as a sentence. ys ("you surround") plus iw (Chapter 3's inner-word object) plus ) (the delimiter to add) — "surround the inner word with parentheses." vim-surround deliberately reuses the exact text-object vocabulary from Chapter 3 rather than inventing new motion syntax, which is why it composes so naturally once text objects are already familiar.
Installing and Managing Plugins
Workflow — adding a new plugin to an existing setup
Plug '...' line between the existing plug#begin()/plug#end() pair.
.vimrc you just edited, without restarting Vim.