From 0a05f02d493ce55685ec7feaf435003e3f4ad7be Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 16 Oct 2014 21:30:58 +0200 Subject: [PATCH] Allow to configure lhs mappings to be used Fixes https://github.com/tpope/vim-repeat/issues/19 --- autoload/repeat.vim | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/autoload/repeat.vim b/autoload/repeat.vim index 18b1280..0f4f831 100644 --- a/autoload/repeat.vim +++ b/autoload/repeat.vim @@ -52,6 +52,23 @@ let g:loaded_repeat = 1 let g:repeat_tick = -1 let g:repeat_reg = ['', ''] +if !exists('g:repeat_map_dot') + let g:repeat_map_dot = '.' +endif +if !exists('g:repeat_map_u') + let g:repeat_map_u = 'u' +endif +if !exists('g:repeat_map_U') + if maparg('U','n') ==# '' + let g:repeat_map_U = 'U' + else + let g:repeat_map_U = '' + endif +endif +if !exists('g:repeat_map_C_R') + let g:repeat_map_C_R = '' +endif + " Special function to avoid spurious repeats in a related, naturally repeating " mapping when your repeatable mapping doesn't increase b:changedtick. function! repeat#invalidate() @@ -103,12 +120,18 @@ function! repeat#wrap(command,count) endif endfunction -nnoremap . :call repeat#run(v:count) -nnoremap u :call repeat#wrap('u',v:count) -if maparg('U','n') ==# '' - nnoremap U :call repeat#wrap('U',v:count) +if len(g:repeat_map_dot) + exe 'nnoremap '.g:repeat_map_dot.' :call repeat#run(v:count)' +endif +if len(g:repeat_map_u) + exe 'nnoremap '.g:repeat_map_u.' :call repeat#wrap("u",v:count)' +endif +if len(g:repeat_map_U) + exe 'nnoremap '.g:repeat_map_U.' :call repeat#wrap("U",v:count)' +endif +if len(g:repeat_map_u) + exe 'nnoremap '.g:repeat_map_C_R.' :call repeat#wrap("\C-R>",v:count)' endif -nnoremap :call repeat#wrap("\C-R>",v:count) augroup repeatPlugin autocmd!