mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-09 09:50:06 +08:00
fix(flygrep): check has('timers')
This commit is contained in:
parent
28fc230368
commit
26addd7078
@ -44,6 +44,16 @@ function! s:close_flygrep_win() abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
if has('timers')
|
||||||
|
function! s:timer_start(...) abort
|
||||||
|
return call('timer_start', a:000)
|
||||||
|
endfunction
|
||||||
|
function! s:timer_stop(...) abort
|
||||||
|
return call('timer_stop', a:000)
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
endif
|
||||||
|
|
||||||
" Init local options: {{{
|
" Init local options: {{{
|
||||||
let s:grep_expr = ''
|
let s:grep_expr = ''
|
||||||
let [
|
let [
|
||||||
@ -203,8 +213,8 @@ function! s:flygrep(expr) abort
|
|||||||
hi def link FlyGrepPattern MoreMsg
|
hi def link FlyGrepPattern MoreMsg
|
||||||
let s:hi_id = s:matchadd('FlyGrepPattern', s:expr_to_pattern(a:expr), 2)
|
let s:hi_id = s:matchadd('FlyGrepPattern', s:expr_to_pattern(a:expr), 2)
|
||||||
let s:grep_expr = a:expr
|
let s:grep_expr = a:expr
|
||||||
call timer_stop(s:grep_timer_id)
|
call s:timer_stop(s:grep_timer_id)
|
||||||
let s:grep_timer_id = timer_start(200, function('s:grep_timer'), {'repeat' : 1})
|
let s:grep_timer_id = s:timer_start(200, function('s:grep_timer'), {'repeat' : 1})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
@ -244,7 +254,7 @@ function! s:filter(expr) abort
|
|||||||
hi def link FlyGrepPattern MoreMsg
|
hi def link FlyGrepPattern MoreMsg
|
||||||
let s:hi_id = s:matchadd('FlyGrepPattern', s:expr_to_pattern(a:expr), 2)
|
let s:hi_id = s:matchadd('FlyGrepPattern', s:expr_to_pattern(a:expr), 2)
|
||||||
let s:grep_expr = a:expr
|
let s:grep_expr = a:expr
|
||||||
let s:grep_timer_id = timer_start(200, function('s:filter_timer'), {'repeat' : 1})
|
let s:grep_timer_id = s:timer_start(200, function('s:filter_timer'), {'repeat' : 1})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" @vimlint(EVL103, 1, a:timer)
|
" @vimlint(EVL103, 1, a:timer)
|
||||||
@ -343,8 +353,8 @@ function! s:close_buffer() abort
|
|||||||
if s:grepid > 0
|
if s:grepid > 0
|
||||||
call s:JOB.stop(s:grepid)
|
call s:JOB.stop(s:grepid)
|
||||||
endif
|
endif
|
||||||
call timer_stop(s:grep_timer_id)
|
call s:timer_stop(s:grep_timer_id)
|
||||||
call timer_stop(s:preview_timer_id)
|
call s:timer_stop(s:preview_timer_id)
|
||||||
if s:preview_able == 1
|
if s:preview_able == 1
|
||||||
for id in s:previewd_bufnrs
|
for id in s:previewd_bufnrs
|
||||||
try
|
try
|
||||||
@ -370,8 +380,8 @@ function! s:close_grep_job() abort
|
|||||||
endtry
|
endtry
|
||||||
let s:std_line = 0
|
let s:std_line = 0
|
||||||
endif
|
endif
|
||||||
call timer_stop(s:grep_timer_id)
|
call s:timer_stop(s:grep_timer_id)
|
||||||
call timer_stop(s:preview_timer_id)
|
call s:timer_stop(s:preview_timer_id)
|
||||||
noautocmd normal! gg"_dG
|
noautocmd normal! gg"_dG
|
||||||
call s:update_statusline()
|
call s:update_statusline()
|
||||||
let s:complete_input_history_num = [0,0]
|
let s:complete_input_history_num = [0,0]
|
||||||
@ -729,8 +739,8 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
function! s:preview() abort
|
function! s:preview() abort
|
||||||
call timer_stop(s:preview_timer_id)
|
call s:timer_stop(s:preview_timer_id)
|
||||||
let s:preview_timer_id = timer_start(200, function('s:preview_timer'), {'repeat' : 1})
|
let s:preview_timer_id = s:timer_start(200, function('s:preview_timer'), {'repeat' : 1})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:grep_mode = 'expr'
|
let s:grep_mode = 'expr'
|
||||||
|
Loading…
Reference in New Issue
Block a user