Vim surround

Tags: vim

Vim surround with

If you have Vim surround with plugin installed, you can use a powerful command of surround with to add or remove character around a word.

Add surround character

ys<motion><character>

For ys, you can remember as "you surround".

Example

Surround the word hello with double quote

yse" or ysaw" or ysw"

enter image description here

Change surround character

cs<current-character><new-character>

For cs, you can remember as "change surround.

Example

Change surround character from " to '.

cs'"

enter image description here

Surround with visual mode

<visual mode selection>S<character>

Example

Select world hello with visual mode and then surround with character ".

veS"

Select to the end of word, then surround with '.

enter image description here

Delete surround character

ds<chracter>

Example

Delete a surround character ".

ds"

enter image description here