Skip to content
This repository has been archived by the owner on May 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request tpope#47 from orlp/master
Browse files Browse the repository at this point in the history
Prevent stack trace of search errors.
  • Loading branch information
tpope committed May 9, 2015
2 parents 5bacc6f + e42a430 commit 7a6675f
Showing 1 changed file with 30 additions and 25 deletions.
55 changes: 30 additions & 25 deletions autoload/repeat.vim
Expand Up @@ -74,34 +74,39 @@ function! repeat#setreg(sequence,register)
endfunction

function! repeat#run(count)
if g:repeat_tick == b:changedtick
let r = ''
if g:repeat_reg[0] ==# g:repeat_sequence && !empty(g:repeat_reg[1])
if g:repeat_reg[1] ==# '='
" This causes a re-evaluation of the expression on repeat, which
" is what we want.
let r = '"=' . getreg('=', 1) . "\<CR>"
else
let r = '"' . g:repeat_reg[1]
try
if g:repeat_tick == b:changedtick
let r = ''
if g:repeat_reg[0] ==# g:repeat_sequence && !empty(g:repeat_reg[1])
if g:repeat_reg[1] ==# '='
" This causes a re-evaluation of the expression on repeat, which
" is what we want.
let r = '"=' . getreg('=', 1) . "\<CR>"
else
let r = '"' . g:repeat_reg[1]
endif
endif
endif

let c = g:repeat_count
let s = g:repeat_sequence
let cnt = c == -1 ? "" : (a:count ? a:count : (c ? c : ''))
if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601')))
exe 'norm ' . r . cnt . s
else
call feedkeys(s, 'i')
call feedkeys(r . cnt, 'ni')
endif
else
if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601')))
exe 'norm! '.(a:count ? a:count : '') . '.'
let c = g:repeat_count
let s = g:repeat_sequence
let cnt = c == -1 ? "" : (a:count ? a:count : (c ? c : ''))
if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601')))
exe 'norm ' . r . cnt . s
else
call feedkeys(s, 'i')
call feedkeys(r . cnt, 'ni')
endif
else
call feedkeys((a:count ? a:count : '') . '.', 'ni')
if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601')))
exe 'norm! '.(a:count ? a:count : '') . '.'
else
call feedkeys((a:count ? a:count : '') . '.', 'ni')
endif
endif
endif
catch /^Vim(normal):/
return 'echoerr v:errmsg'
endtry
return ''
endfunction

function! repeat#wrap(command,count)
Expand All @@ -112,7 +117,7 @@ function! repeat#wrap(command,count)
endif
endfunction

nnoremap <silent> <Plug>(RepeatDot) :<C-U>call repeat#run(v:count)<CR>
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>
Expand Down

0 comments on commit 7a6675f

Please sign in to comment.