finds.dev← search

// the find

tpope/vim-surround

★ 14,105 · Vim Script · updated Jun 2024

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

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

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →