mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-23 22:15:28 +02:00
searchcount: Ignore errors from searchcount() function
If the search regex causes an error, an ugly error message is thrown, so ignore errors in that case silently. closes #2216
This commit is contained in:
parent
ef4666bd86
commit
3a55368320
@ -18,6 +18,7 @@ function! airline#extensions#searchcount#apply(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#searchcount#status() abort
|
function! airline#extensions#searchcount#status() abort
|
||||||
|
try
|
||||||
let result = searchcount(#{recompute: 1, maxcount: -1})
|
let result = searchcount(#{recompute: 1, maxcount: -1})
|
||||||
if empty(result) || result.total ==# 0
|
if empty(result) || result.total ==# 0
|
||||||
return ''
|
return ''
|
||||||
@ -36,4 +37,7 @@ function! airline#extensions#searchcount#status() abort
|
|||||||
endif
|
endif
|
||||||
return printf('%s[%d/%d]', @/,
|
return printf('%s[%d/%d]', @/,
|
||||||
\ result.current, result.total)
|
\ result.current, result.total)
|
||||||
|
catch
|
||||||
|
return ''
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user