mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 22:20:06 +08:00
Searching when input delay 1000ms
This commit is contained in:
parent
081beb8170
commit
52a4ec3e1a
@ -15,6 +15,18 @@ function! SpaceVim#plugins#flygrep#open() abort
|
||||
let &t_ve = save_tve
|
||||
endfunction
|
||||
|
||||
let s:grep_expr = ''
|
||||
let s:grep_exe = SpaceVim#mapping#search#default_tool()
|
||||
let s:grep_timer_id = 0
|
||||
|
||||
function! s:grep_timer(timer) abort
|
||||
let s:grepid = s:JOB.start(s:get_search_cmd(s:grep_exe, s:grep_expr), {
|
||||
\ 'on_stdout' : function('s:grep_stdout'),
|
||||
\ 'in_io' : 'null',
|
||||
\ 'on_exit' : function('s:grep_exit'),
|
||||
\ })
|
||||
endfunction
|
||||
|
||||
function! s:flygrep(expr) abort
|
||||
call s:MPT._build_prompt()
|
||||
if a:expr ==# ''
|
||||
@ -27,12 +39,7 @@ function! s:flygrep(expr) abort
|
||||
endtr
|
||||
exe 'syn match FileNames /' . substitute(a:expr, '\([/\\]\)', '\\\1', 'g') . '/'
|
||||
hi def link FileNames MoreMsg
|
||||
let exe = SpaceVim#mapping#search#default_tool()
|
||||
let s:grepid = s:JOB.start(s:get_search_cmd(exe, a:expr), {
|
||||
\ 'on_stdout' : function('s:grep_stdout'),
|
||||
\ 'in_io' : 'null',
|
||||
\ 'on_exit' : function('s:grep_exit'),
|
||||
\ })
|
||||
let s:grep_timer_id = timer_start(1000, funcref('s:grep_timer'), {'repeat' : 1})
|
||||
endfunction
|
||||
|
||||
let s:MPT._handle_fly = function('s:flygrep')
|
||||
@ -48,6 +55,9 @@ function! s:close_grep_job() abort
|
||||
if s:grepid != 0
|
||||
call s:JOB.stop(s:grepid)
|
||||
endif
|
||||
if s:grep_timer_id != 0
|
||||
call timer_stop(s:grep_timer_id)
|
||||
endif
|
||||
normal! "_ggdG
|
||||
endfunction
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user