Show Menu

vim tpope/vim-surround Cheat Sheet by

Shortcuts for tpope's vim-surround plugin
shortcuts     vim     plugin     keys     vim-surround

Delete surrou­ndings

ds
delete surrou­nding
ds"
delete surrou­nding "
ds)
delete surrou­nding ()
dst
delete surrou­nding (html)tag
Examples

Visual mode

S"
surround selected text with "
S<p>
surround selected text with <p> ... </p>
Examples in visual mode

Targets

The |ds| and |cs| commands both take a target as their first argument. The
possible targets are based closely on the |text-objects| provided by Vim.
All targets are currently just one character.

(, ), {, }, [, ], <, and >
The targets b, B, r, and a are aliases for ), }, ], and >
 ', ", `,
A t is a pair of HTML or XML tags.

The letters w, W, and s correspond to a |word|, a |WORD|, and a |sentence|. A p represents a |paragraph|
 

Change surrou­ndings

cs"'
change surrou­nding " to '
cs"<­q>
change surrou­nding " to <q>­some text­</q>
cst<p>
change surrou­nding tag with <p>
cs)]
change surrou­nding () to []
cs)[
change surrou­nding () to [] with spaces
Examples
 

Create surrou­ndings

ysiw)
add surrou­nding () to inner word
yss]
add surrou­nding [] to whole line, without leading whitespace
Examples

functions

ysWfprint<cr>
wraps old text into a function print
ysWFprint<cr>
wraps a WORD into a function print with spaces

Download the vim tpope/vim-surround Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/mutanclan_vim-tpope-vim-surround.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          vim.spf13 Cheat Sheet
          Basic Vim Cheat Sheet
          Vimium Shortcuts Cheat Sheet

          More Cheat Sheets by mutanclan

          tmux shortcuts Cheat Sheet
          vim vixen firefox addon Cheat Sheet