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:
@@ -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
|
||||
|
||||
|
||||
23
vim/wrap-with-some-room.md
Normal file
23
vim/wrap-with-some-room.md
Normal 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 ]`.
|
||||
Reference in New Issue
Block a user