mirror of
https://github.com/amix/vimrc
synced 2025-06-23 06:35:01 +08:00
Updated plugins
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
surround.vim
|
||||
============
|
||||
# surround.vim
|
||||
|
||||
Surround.vim is all about "surroundings": parentheses, brackets, quotes,
|
||||
XML tags, and more. The plugin provides mappings to easily delete,
|
||||
@ -61,37 +60,32 @@ 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
|
||||
------------
|
||||
## Installation
|
||||
|
||||
If you don't have a preferred installation method, I recommend
|
||||
installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and
|
||||
then simply copy and paste:
|
||||
Install using your favorite package manager, or use Vim's built-in package
|
||||
support:
|
||||
|
||||
cd ~/.vim/bundle
|
||||
git clone git://github.com/tpope/vim-surround.git
|
||||
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
|
||||
|
||||
Once help tags have been generated, you can view the manual with
|
||||
`:help surround`.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
## Contributing
|
||||
|
||||
See the contribution guidelines for
|
||||
[pathogen.vim](https://github.com/tpope/vim-pathogen#readme).
|
||||
|
||||
Self-Promotion
|
||||
--------------
|
||||
## Self-Promotion
|
||||
|
||||
Like surround.vim? Follow the repository on
|
||||
Like surround.vim? Star the repository on
|
||||
[GitHub](https://github.com/tpope/vim-surround) and vote for it on
|
||||
[vim.org](http://www.vim.org/scripts/script.php?script_id=1697). And if
|
||||
you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
|
||||
[Twitter](http://twitter.com/tpope) and
|
||||
[GitHub](https://github.com/tpope).
|
||||
[vim.org](https://www.vim.org/scripts/script.php?script_id=1697).
|
||||
|
||||
License
|
||||
-------
|
||||
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`.
|
||||
|
@ -478,7 +478,11 @@ function! s:changesurround(...) " {{{1
|
||||
call s:dosurround(a,b,a:0 && a:1)
|
||||
endfunction " }}}1
|
||||
|
||||
function! s:opfunc(type,...) " {{{1
|
||||
function! s:opfunc(type, ...) abort " {{{1
|
||||
if a:type ==# 'setup'
|
||||
let &opfunc = matchstr(expand('<sfile>'), '<SNR>\w\+$')
|
||||
return 'g@'
|
||||
endif
|
||||
let char = s:inputreplacement()
|
||||
if char == ""
|
||||
return s:beep()
|
||||
@ -541,8 +545,12 @@ function! s:opfunc(type,...) " {{{1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:opfunc2(arg)
|
||||
call s:opfunc(a:arg,1)
|
||||
function! s:opfunc2(...) abort
|
||||
if !a:0 || a:1 ==# 'setup'
|
||||
let &opfunc = matchstr(expand('<sfile>'), '<SNR>\w\+$')
|
||||
return 'g@'
|
||||
endif
|
||||
call s:opfunc(a:1, 1)
|
||||
endfunction " }}}1
|
||||
|
||||
function! s:closematch(str) " {{{1
|
||||
@ -565,11 +573,10 @@ nnoremap <silent> <Plug>SurroundRepeat .
|
||||
nnoremap <silent> <Plug>Dsurround :<C-U>call <SID>dosurround(<SID>inputtarget())<CR>
|
||||
nnoremap <silent> <Plug>Csurround :<C-U>call <SID>changesurround()<CR>
|
||||
nnoremap <silent> <Plug>CSurround :<C-U>call <SID>changesurround(1)<CR>
|
||||
nnoremap <silent> <Plug>Yssurround :<C-U>call <SID>opfunc(v:count1)<CR>
|
||||
nnoremap <silent> <Plug>YSsurround :<C-U>call <SID>opfunc2(v:count1)<CR>
|
||||
" <C-U> discards the numerical argument but there's not much we can do with it
|
||||
nnoremap <silent> <Plug>Ysurround :<C-U>set opfunc=<SID>opfunc<CR>g@
|
||||
nnoremap <silent> <Plug>YSurround :<C-U>set opfunc=<SID>opfunc2<CR>g@
|
||||
nnoremap <expr> <Plug>Yssurround <SID>opfunc('setup').'g_'
|
||||
nnoremap <expr> <Plug>YSsurround <SID>opfunc2('setup').'_'
|
||||
nnoremap <expr> <Plug>Ysurround <SID>opfunc('setup')
|
||||
nnoremap <expr> <Plug>YSurround <SID>opfunc2('setup')
|
||||
vnoremap <silent> <Plug>VSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 1 : 0)<CR>
|
||||
vnoremap <silent> <Plug>VgSurround :<C-U>call <SID>opfunc(visualmode(),visualmode() ==# 'V' ? 0 : 1)<CR>
|
||||
inoremap <silent> <Plug>Isurround <C-R>=<SID>insert()<CR>
|
||||
|
Reference in New Issue
Block a user