diff --git a/autoload/repeat.vim b/autoload/repeat.vim index 708c318..6b2b0f0 100644 --- a/autoload/repeat.vim +++ b/autoload/repeat.vim @@ -44,11 +44,6 @@ " \ call MyFunction(v:register, ...) " \ silent! call repeat#set("\Plug>MyMap") -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 (RepeatDot) :exe repeat#run(v:count) -nnoremap (RepeatUndo) :call repeat#wrap('u',v:count) -nnoremap (RepeatUndoLine) :call repeat#wrap('U',v:count) -nnoremap (RepeatRedo) :call repeat#wrap("\C-R>",v:count) - -if !hasmapto('(RepeatDot)', 'n') - nmap . (RepeatDot) -endif -if !hasmapto('(RepeatUndo)', 'n') - nmap u (RepeatUndo) -endif -if maparg('U','n') ==# '' && !hasmapto('(RepeatUndoLine)', 'n') - nmap U (RepeatUndoLine) -endif -if !hasmapto('(RepeatRedo)', 'n') - nmap (RepeatRedo) -endif - augroup repeatPlugin autocmd! autocmd BufLeave,BufWritePre,BufReadPre * let g:repeat_tick = (g:repeat_tick == b:changedtick || g:repeat_tick == 0) ? 0 : -1 diff --git a/plugin/repeat.vim b/plugin/repeat.vim new file mode 100644 index 0000000..de04916 --- /dev/null +++ b/plugin/repeat.vim @@ -0,0 +1,20 @@ +if exists("g:loaded_repeat") || &cp || v:version < 700 + finish +endif +let g:loaded_repeat = 1 + + +nnoremap (RepeatDot) :exe repeat#run(v:count) +nnoremap (RepeatUndo) :call repeat#wrap('u',v:count) +nnoremap (RepeatUndoLine) :call repeat#wrap('U',v:count) +nnoremap (RepeatRedo) :call repeat#wrap("\C-R>",v:count) + + +if !exists('g:repeat_no_default_key_mappings') || !g:repeat_no_default_key_mappings + nmap . (RepeatDot) + nmap u (RepeatUndo) + nmap U (RepeatUndoLine) + nmap (RepeatRedo) +endif + +" vim:set ft=vim et sw=4 sts=4: