finds.dev

tpope/vim-surround

surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease

View on GitHubHomepage ↗

★ 14,105Vim Scriptupdated Jun 2024

// the take

surround.vim adds vim motions for adding, changing, and deleting paired delimiters — quotes, brackets, HTML/XML tags — using the same verb-object grammar as native Vim commands. It's for anyone editing code or markup in Vim who's tired of manually counting parens or retyping tag names.

- The mapping design (ds, cs, ys + a text object or motion) fits Vim's existing grammar instead of inventing new modal behavior, so it's fast to internalize if you already think in Vim verbs/objects

- Tag-aware surrounds are genuinely hard to replicate with raw Vim macros — it parses the tag name and reuses it on `cst` operations, which is the one thing here that isn't trivial to hand-roll

- Zero dependencies, single plugin file, works via Vim's native package manager — no plugin manager, no async jobs, nothing to break on a Vim/Neovim version bump

- 14 years of production use by effectively the entire Vim plugin ecosystem means the edge cases (nested delimiters, visual-block mode, multi-line tags) are well worn-in

- Last push mid-2024 and it's Vim9-script-free, plain legacy Vimscript — fine functionally, but don't expect Lua/Neovim-native performance work or async anything

- .` repeat support requires installing a second plugin (repeat.vim) — a first-time user pressing `.` after `cs"'` will get confused when nothing happens

- README examples assume you already know Vim text objects (`iw`, visual linewise); there's no walkthrough for someone who isn't already comfortable with operator-pending mode

- No Lua rewrite or Neovim-specific integration — if you're on Neovim there are newer alternatives (nvim-surround, mini.surround) with more discoverable config and treesitter-aware surrounds

We read the README, the directory tree and a key source file in September 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
14,105
Forks
447
Language
Vim Script
Last commit
30 Jun 2024

// nearby

If vim-surround isn't quite it.

All repos →