Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tpope/vim-surround
surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease
https://github.com/tpope/vim-surround
Last synced: 17 days ago
JSON representation
surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease
- Host: GitHub
- URL: https://github.com/tpope/vim-surround
- Owner: tpope
- Created: 2008-09-11T01:00:16.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2024-06-30T12:27:56.000Z (5 months ago)
- Last Synced: 2024-11-15T19:48:12.218Z (27 days ago)
- Language: Vim Script
- Homepage: https://www.vim.org/scripts/script.php?script_id=1697
- Size: 126 KB
- Stars: 13,463
- Watchers: 130
- Forks: 445
- Open Issues: 133
-
Metadata Files:
- Readme: README.markdown
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- awesome-starred-test - tpope/vim-surround - surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease (Vim Script)
- awesome - tpope/vim-surround - surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease (Vim Script)
- awesome-starred - vim-surround - surround.vim: quoting/parenthesizing made simple (Vim script)
- awesome-list - vim-surround
README
# surround.vim
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'` to change it to
Hello world!
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`
Hello world!
Finally, let's try out visual mode. Press a capital V (for linewise
visual mode) followed by `S`.
Hello world!
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).## Installation
Install using your favorite package manager, or use Vim's built-in package
support: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## FAQ
> How do I surround without adding a space?
Only the opening brackets—`[`, `{`, and `(`—add a space. Use a closing
bracket, or the `b` (`(`) and `B` (`{`) aliases.## Contributing
See the contribution guidelines for
[pathogen.vim](https://github.com/tpope/vim-pathogen#readme).## Self-Promotion
Like surround.vim? Star the repository on
[GitHub](https://github.com/tpope/vim-surround) and vote for it on
[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).## License
Copyright (c) Tim Pope. Distributed under the same terms as Vim itself.
See `:help license`.