1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2014-04-18 13:58:02 +01:00
parent ac3ef260c8
commit 6a16a9393c
91 changed files with 2554 additions and 708 deletions

View File

@ -44,10 +44,16 @@ function! s:go(type,...) abort
endif
call setline(lnum,line)
endfor
silent doautocmd User CommentaryPost
let modelines = &modelines
try
set modelines=0
silent doautocmd User CommentaryPost
finally
let &modelines = modelines
endtry
endfunction
function! s:undo() abort
function! s:textobject(inner) abort
let [l, r] = s:surroundings()
let lnums = [line('.')+1, line('.')-2]
for [index, dir, bound, line] in [[0, -1, 1, ''], [1, 1, line('$'), '']]
@ -56,27 +62,38 @@ function! s:undo() abort
let line = matchstr(getline(lnums[index]+dir),'\S.*\s\@<!')
endwhile
endfor
call s:go(lnums[0], lnums[1])
silent! call repeat#set("\<Plug>CommentaryUndo")
while (a:inner || lnums[1] != line('$')) && empty(getline(lnums[0]))
let lnums[0] += 1
endwhile
while a:inner && empty(getline(lnums[1]))
let lnums[1] -= 1
endwhile
if lnums[0] <= lnums[1]
execute 'normal! 'lnums[0].'GV'.lnums[1].'G'
endif
endfunction
xnoremap <silent> <Plug>Commentary :<C-U>call <SID>go(line("'<"),line("'>"))<CR>
nnoremap <silent> <Plug>Commentary :<C-U>set opfunc=<SID>go<CR>g@
nnoremap <silent> <Plug>CommentaryLine :<C-U>set opfunc=<SID>go<Bar>exe 'norm! 'v:count1.'g@_'<CR>
nnoremap <silent> <Plug>CommentaryUndo :<C-U>call <SID>undo()<CR>
onoremap <silent> <Plug>Commentary :<C-U>call <SID>textobject(0)<CR>
nnoremap <silent> <Plug>ChangeCommentary c:<C-U>call <SID>textobject(1)<CR>
nmap <silent> <Plug>CommentaryUndo <Plug>Commentary<Plug>Commentary
if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
if 1 || !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
xmap gc <Plug>Commentary
nmap gc <Plug>Commentary
omap gc <Plug>Commentary
nmap gcc <Plug>CommentaryLine
nmap gcu <Plug>CommentaryUndo
nmap cgc <Plug>ChangeCommentary
nmap gcu <Plug>Commentary<Plug>Commentary
endif
if maparg('\\','n') ==# '' && maparg('\','n') ==# '' && get(g:, 'commentary_map_backslash', 1)
xmap \\ <Plug>Commentary
nmap \\ <Plug>Commentary
nmap \\\ <Plug>CommentaryLine
nmap \\u <Plug>CommentaryUndo
xmap \\ <Plug>Commentary:echomsg '\\ is deprecated. Use gc'<CR>
nmap \\ :echomsg '\\ is deprecated. Use gc'<CR><Plug>Commentary
nmap \\\ <Plug>CommentaryLine:echomsg '\\ is deprecated. Use gc'<CR>
nmap \\u <Plug>CommentaryUndo:echomsg '\\ is deprecated. Use gc'<CR>
endif
" vim:set et sw=2: