Atom Packages Directory

a package directory for a text editor of the 21st Century

Vim Surround

Install with:
    apm install vim-surround
  

Vim Surround for Atom Build Status

Surround is an implementation of vim-surround for the atom editor, creating a vim-surround with the power of Atom!

You should definitely have vim-mode for this package to function properly, of course.

Inspiration from and kudos to the wonderful vim-surround for vim

See vim-surround on github or atom.io.

News

Muscle Memory Compatability Note

vim-surround uses a lowercase s instead of S for surround commands! This is configurable in the package settings, if you would like to set it to the original keybinding.

How to use Surround

Surrounding

For double quotes, highlight the string in visual mode and enter s ".

Hello world -> "Hello world"

For parentheses there are two options. s ) will surround as normal. s ( will pad with a space. All asymmetrical pairs have the secondary space-padded form.

For example:

s )

Hello world -> (Hello world)

s (

Hello world -> ( Hello world )

Changing Surrounding Pairs

Suppose I want to make double quotes into single quotes. To do this, I should put my cursor inside the double quotes in question and enter c s " '

"Hello world" -> 'Hello world'

Deleting Surrounding Pairs

To delete the single quotes, place your cursor inside of them and enter d s '

'Hello world' -> Hello world ### Configuration

Currently, the following pairs work out of the box!:

You can add to the available pairs in atom’s settings, and the commands will be dynamically added to your keybindings.

For example if I’m working on Jinja templates, and I want to add the ability to surround using {% and %} I would add this in my settings:

(), [], {}, "", '', {%%}

Then:

s % }

Hello world -> {%Hello world%}

s { %

Hello world -> {% Hello world %}

TODO

Keywords: pair, parentheses, quotes, surround, vim Suggest keywords
Fork me on GitHub