diff --git a/README.md b/README.md index 67df5c1..cc68830 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ smart people at [Hashrocket](http://hashrocket.com/). - [Repeat The Previous Change](vim/repeat-the-previous-change.md) - [Split Different](vim/split-different.md) - [View Commit History of a File](vim/view-commit-history-of-a-file.md) +- [Wrap With Some Room](vim/wrap-with-some-room.md) ### zsh diff --git a/vim/wrap-with-some-room.md b/vim/wrap-with-some-room.md new file mode 100644 index 0000000..d479b23 --- /dev/null +++ b/vim/wrap-with-some-room.md @@ -0,0 +1,23 @@ +# Wrap With Some Room + +The surround.vim plugin allows you to wrap text objects with various +surrounding characters (e.g. `( )`, `{ }`, `" "`). If you have a visual +selection on `1 2 3 4 5` and type `S]` you will get: + +``` +[1 2 3 4 5] +``` + +That works, but if you prefer a more readable version with some extra +breathing room, you can make the visual selection and hit `S[` which will +stick a space on either end: + +``` +[ 1 2 3 4 5 ] +``` + +Now, if you already have some text wrapped in square braces, like the +first example, and you want to convert it to the more spacious second +example, you can do a *change surround* command followed by hitting the +open square brace twice (that is, `cs[[`) which will convert +`[1 2 3 4 5]` to `[ 1 2 3 4 5 ]`.