mirror of
https://github.com/tpope/vim-repeat.git
synced 2026-09-10 07:16:26 -04:00
Add mapping feature
This commit is contained in:
parent
c947ad2b6a
commit
12bd98cb59
|
|
@ -44,11 +44,6 @@
|
|||
" \ call <SID>MyFunction(v:register, ...)<Bar>
|
||||
" \ silent! call repeat#set("\<lt>Plug>MyMap")<CR>
|
||||
|
||||
if exists("g:loaded_repeat") || &cp || v:version < 700
|
||||
finish
|
||||
endif
|
||||
let g:loaded_repeat = 1
|
||||
|
||||
let g:repeat_tick = -1
|
||||
let g:repeat_reg = ['', '']
|
||||
|
||||
|
|
@ -138,24 +133,6 @@ function! repeat#wrap(command,count)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <Plug>(RepeatDot) :<C-U>exe repeat#run(v:count)<CR>
|
||||
nnoremap <silent> <Plug>(RepeatUndo) :<C-U>call repeat#wrap('u',v:count)<CR>
|
||||
nnoremap <silent> <Plug>(RepeatUndoLine) :<C-U>call repeat#wrap('U',v:count)<CR>
|
||||
nnoremap <silent> <Plug>(RepeatRedo) :<C-U>call repeat#wrap("\<Lt>C-R>",v:count)<CR>
|
||||
|
||||
if !hasmapto('<Plug>(RepeatDot)', 'n')
|
||||
nmap . <Plug>(RepeatDot)
|
||||
endif
|
||||
if !hasmapto('<Plug>(RepeatUndo)', 'n')
|
||||
nmap u <Plug>(RepeatUndo)
|
||||
endif
|
||||
if maparg('U','n') ==# '' && !hasmapto('<Plug>(RepeatUndoLine)', 'n')
|
||||
nmap U <Plug>(RepeatUndoLine)
|
||||
endif
|
||||
if !hasmapto('<Plug>(RepeatRedo)', 'n')
|
||||
nmap <C-R> <Plug>(RepeatRedo)
|
||||
endif
|
||||
|
||||
augroup repeatPlugin
|
||||
autocmd!
|
||||
autocmd BufLeave,BufWritePre,BufReadPre * let g:repeat_tick = (g:repeat_tick == b:changedtick || g:repeat_tick == 0) ? 0 : -1
|
||||
|
|
|
|||
20
plugin/repeat.vim
Normal file
20
plugin/repeat.vim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
if exists("g:loaded_repeat") || &cp || v:version < 700
|
||||
finish
|
||||
endif
|
||||
let g:loaded_repeat = 1
|
||||
|
||||
|
||||
nnoremap <silent> <Plug>(RepeatDot) :<C-U>exe repeat#run(v:count)<CR>
|
||||
nnoremap <silent> <Plug>(RepeatUndo) :<C-U>call repeat#wrap('u',v:count)<CR>
|
||||
nnoremap <silent> <Plug>(RepeatUndoLine) :<C-U>call repeat#wrap('U',v:count)<CR>
|
||||
nnoremap <silent> <Plug>(RepeatRedo) :<C-U>call repeat#wrap("\<Lt>C-R>",v:count)<CR>
|
||||
|
||||
|
||||
if !exists('g:repeat_no_default_key_mappings') || !g:repeat_no_default_key_mappings
|
||||
nmap . <Plug>(RepeatDot)
|
||||
nmap u <Plug>(RepeatUndo)
|
||||
nmap U <Plug>(RepeatUndoLine)
|
||||
nmap <C-R> <Plug>(RepeatRedo)
|
||||
endif
|
||||
|
||||
" vim:set ft=vim et sw=4 sts=4:
|
||||
Loading…
Reference in a new issue