Skip to content

Commit 655dd3e

Browse files
committed
Prevent stack trace of search errors.
1 parent c4f9f15 commit 655dd3e

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

autoload/repeat.vim

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -74,34 +74,38 @@ function! repeat#setreg(sequence,register)
7474
endfunction
7575

7676
function! repeat#run(count)
77-
if g:repeat_tick == b:changedtick
78-
let r = ''
79-
if g:repeat_reg[0] ==# g:repeat_sequence && !empty(g:repeat_reg[1])
80-
if g:repeat_reg[1] ==# '='
81-
" This causes a re-evaluation of the expression on repeat, which
82-
" is what we want.
83-
let r = '"=' . getreg('=', 1) . "\<CR>"
84-
else
85-
let r = '"' . g:repeat_reg[1]
77+
try
78+
if g:repeat_tick == b:changedtick
79+
let r = ''
80+
if g:repeat_reg[0] ==# g:repeat_sequence && !empty(g:repeat_reg[1])
81+
if g:repeat_reg[1] ==# '='
82+
" This causes a re-evaluation of the expression on repeat, which
83+
" is what we want.
84+
let r = '"=' . getreg('=', 1) . "\<CR>"
85+
else
86+
let r = '"' . g:repeat_reg[1]
87+
endif
8688
endif
87-
endif
8889

89-
let c = g:repeat_count
90-
let s = g:repeat_sequence
91-
let cnt = c == -1 ? "" : (a:count ? a:count : (c ? c : ''))
92-
if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601')))
93-
exe 'norm ' . r . cnt . s
94-
else
95-
call feedkeys(s, 'i')
96-
call feedkeys(r . cnt, 'ni')
97-
endif
98-
else
99-
if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601')))
100-
exe 'norm! '.(a:count ? a:count : '') . '.'
90+
let c = g:repeat_count
91+
let s = g:repeat_sequence
92+
let cnt = c == -1 ? "" : (a:count ? a:count : (c ? c : ''))
93+
if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601')))
94+
exe 'norm ' . r . cnt . s
95+
else
96+
call feedkeys(s, 'i')
97+
call feedkeys(r . cnt, 'ni')
98+
endif
10199
else
102-
call feedkeys((a:count ? a:count : '') . '.', 'ni')
100+
if ((v:version == 703 && has('patch100')) || (v:version == 704 && !has('patch601')))
101+
exe 'norm! '.(a:count ? a:count : '') . '.'
102+
else
103+
call feedkeys((a:count ? a:count : '') . '.', 'ni')
104+
endif
103105
endif
104-
endif
106+
catch /^Vim\%((\a\+)\)\=:E\%(384\|385\|486\)/
107+
echohl ErrorMsg | echo substitute(v:exception, '^Vim\%((\a\+)\)\=:', '', '') | echohl None
108+
endtry
105109
endfunction
106110

107111
function! repeat#wrap(command,count)

0 commit comments

Comments
 (0)