Vim surround

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"

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 '.

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 '.

yse'

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

Will

Thanks! Nice concise and useful post.