Surround (the Plugin That Should Be Built In)
ds, cs, ys โ operate on surroundings as a first-class concept.
Tim Pope's vim-surround adds three operators: ys (add surrounding), ds (delete surrounding), cs (change surrounding). Once you have it, it feels like core Vim.
Surround
Tim Pope's [vim-surround](https://github.com/tpope/vim-surround) is the plugin most often cited as "this should ship with Vim." It adds three operators that treat surroundings (quotes, brackets, tags) as first-class targets.
| Sequence | Effect |
|---|---|
| ds' | Delete surrounding single quotes |
| dst | Delete surrounding HTML tag |
| cs'" | Change surrounding ' to " |
| cs[( | Change [ ] to ( ) |
| cst | Change surrounding tag (prompts for new tag name) |
| ysiw' | Surround inner word with single quotes |
| yss} | Surround whole line with braces |
| ysip<p> | Wrap paragraph in <p> tags |
| Visual mode + S' | Surround selection with quotes |
See also: Quote Text Objects, Bracket Text Objects