1
0
Fork 0
mirror of synced 2024-12-27 00:53:20 -05:00
ultimate-vim/sources_non_forked/vim-surround/README.markdown

92 lines
2.2 KiB
Markdown
Raw Normal View History

2018-06-14 06:31:12 -04:00
# surround.vim
2012-08-16 23:41:25 -04:00
Surround.vim is all about "surroundings": parentheses, brackets, quotes,
XML tags, and more. The plugin provides mappings to easily delete,
change and add such surroundings in pairs.
It's easiest to explain with examples. Press `cs"'` inside
"Hello world!"
to change it to
'Hello world!'
Now press `cs'<q>` to change it to
<q>Hello world!</q>
To go full circle, press `cst"` to get
"Hello world!"
To remove the delimiters entirely, press `ds"`.
Hello world!
Now with the cursor on "Hello", press `ysiw]` (`iw` is a text object).
[Hello] world!
Let's make that braces and add some space (use `}` instead of `{` for no
space): `cs]{`
{ Hello } world!
Now wrap the entire line in parentheses with `yssb` or `yss)`.
({ Hello } world!)
Revert to the original text: `ds{ds)`
Hello world!
Emphasize hello: `ysiw<em>`
<em>Hello</em> world!
Finally, let's try out visual mode. Press a capital V (for linewise
visual mode) followed by `S<p class="important">`.
<p class="important">
<em>Hello</em> world!
</p>
This plugin is very powerful for HTML and XML editing, a niche which
currently seems underfilled in Vim land. (As opposed to HTML/XML
*inserting*, for which many plugins are available). Adding, changing,
and removing pairs of tags simultaneously is a breeze.
The `.` command will work with `ds`, `cs`, and `yss` if you install
[repeat.vim](https://github.com/tpope/vim-repeat).
2018-06-14 06:31:12 -04:00
## Installation
2012-08-16 23:41:25 -04:00
2018-06-14 06:31:12 -04:00
Install using your favorite package manager, or use Vim's built-in package
support:
2012-08-16 23:41:25 -04:00
2018-06-14 06:31:12 -04:00
mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/surround.git
vim -u NONE -c "helptags surround/doc" -c q
2012-08-16 23:41:25 -04:00
2018-06-14 06:31:12 -04:00
## Contributing
2012-08-16 23:41:25 -04:00
See the contribution guidelines for
[pathogen.vim](https://github.com/tpope/vim-pathogen#readme).
2018-06-14 06:31:12 -04:00
## Self-Promotion
2012-08-16 23:41:25 -04:00
2018-06-14 06:31:12 -04:00
Like surround.vim? Star the repository on
2012-08-16 23:41:25 -04:00
[GitHub](https://github.com/tpope/vim-surround) and vote for it on
2018-06-14 06:31:12 -04:00
[vim.org](https://www.vim.org/scripts/script.php?script_id=1697).
Love surround.vim? Follow [tpope](http://tpo.pe/) on
[GitHub](https://github.com/tpope) and
[Twitter](http://twitter.com/tpope).
2012-08-16 23:41:25 -04:00
2018-06-14 06:31:12 -04:00
## License
2012-08-16 23:41:25 -04:00
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
See `:help license`.