1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-05 08:08:02 +00:00

Add Wrap With Some Room as a vim til.

This commit is contained in:
jbranchaud
2015-03-28 12:22:20 -05:00
parent 1e2db4ab53
commit f90bdd97c3
2 changed files with 24 additions and 0 deletions

View File

@@ -55,6 +55,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
- [Repeat The Previous Change](vim/repeat-the-previous-change.md) - [Repeat The Previous Change](vim/repeat-the-previous-change.md)
- [Split Different](vim/split-different.md) - [Split Different](vim/split-different.md)
- [View Commit History of a File](vim/view-commit-history-of-a-file.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 ### zsh

View File

@@ -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 ]`.