Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rhysd/vim-operator-surround
Vim operator mapping to enclose text objects with surrounds like paren, quote and so on.
https://github.com/rhysd/vim-operator-surround
operator surround vim vim-plugin
Last synced: 3 months ago
JSON representation
Vim operator mapping to enclose text objects with surrounds like paren, quote and so on.
- Host: GitHub
- URL: https://github.com/rhysd/vim-operator-surround
- Owner: rhysd
- Created: 2013-09-19T10:07:39.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-10-14T14:44:28.000Z (over 4 years ago)
- Last Synced: 2024-10-18T21:59:22.168Z (3 months ago)
- Topics: operator, surround, vim, vim-plugin
- Language: Vim script
- Homepage:
- Size: 115 KB
- Stars: 138
- Watchers: 6
- Forks: 8
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Operator to Surround a Text Object
==================================
[![Build Status](https://travis-ci.org/rhysd/vim-operator-surround.svg?branch=master)](https://travis-ci.org/rhysd/vim-operator-surround)This plugin provides Vim operator mappings to deal with surrounds like `()`, `""` and so on.
In addition, both end of the text object are the same character, vim-operator-surround recognizes
them as a surround (this behavior is customizable with some variables).It can
- surround a text object with a specified block.
- replace a surround in a text object with a specified block.
- delete a surround in a text object.This plugin would be more useful with [vim-textobj-between](https://github.com/thinca/vim-textobj-between) or
[vim-textobj-anyblock](https://github.com/rhysd/vim-textobj-anyblock).
And you can customize and add surround definitions in global and filetype specific scope.## Policy of This Plugin (or The Reason Why I Don't Use [vim-surround](https://github.com/tpope/vim-surround))
- **Simplicity** : All should be done with operator mappings.
- **Extensibility** : The behavior should be highly customizable with `g:operator#surround#blocks` and text objects like [vim-textobj-multiblock](https://github.com/osyo-manga/vim-textobj-multiblock), [vim-textobj-between](https://github.com/thinca/vim-textobj-between) or [vim-textobj-anyblock](https://github.com/rhysd/vim-textobj-anyblock).
- **Well-tested**## Requirements
This plugin uses [vim-operator-user](https://github.com/kana/vim-operator-user).
Please install it in advance.## Customize
Set your favorite blocks to `g:operator#surround#blocks`. And control the behavior with some variables.
Please read [doc](doc/operator-surround.txt) for more details.## Example of `vimrc`
```vim
" operator mappings
map sa (operator-surround-append)
map sd (operator-surround-delete)
map sr (operator-surround-replace)" delete or replace most inner surround
" if you use vim-textobj-multiblock
nmap sdd (operator-surround-delete)(textobj-multiblock-a)
nmap srr (operator-surround-replace)(textobj-multiblock-a)" if you use vim-textobj-anyblock
nmap sdd (operator-surround-delete)(textobj-anyblock-a)
nmap srr (operator-surround-replace)(textobj-anyblock-a)" if you use vim-textobj-between
nmap sdb (operator-surround-delete)(textobj-between-a)
nmap srb (operator-surround-replace)(textobj-between-a)
```## License
vim-operator-surround is distributed under MIT license.
Copyright (c) 2013-2017 rhysd
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.