mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-12 09:35:40 +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
|
let &t_ve = save_tve
|
||||||
endfunction
|
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
|
function! s:flygrep(expr) abort
|
||||||
call s:MPT._build_prompt()
|
call s:MPT._build_prompt()
|
||||||
if a:expr ==# ''
|
if a:expr ==# ''
|
||||||
@ -27,12 +39,7 @@ function! s:flygrep(expr) abort
|
|||||||
endtr
|
endtr
|
||||||
exe 'syn match FileNames /' . substitute(a:expr, '\([/\\]\)', '\\\1', 'g') . '/'
|
exe 'syn match FileNames /' . substitute(a:expr, '\([/\\]\)', '\\\1', 'g') . '/'
|
||||||
hi def link FileNames MoreMsg
|
hi def link FileNames MoreMsg
|
||||||
let exe = SpaceVim#mapping#search#default_tool()
|
let s:grep_timer_id = timer_start(1000, funcref('s:grep_timer'), {'repeat' : 1})
|
||||||
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'),
|
|
||||||
\ })
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:MPT._handle_fly = function('s:flygrep')
|
let s:MPT._handle_fly = function('s:flygrep')
|
||||||
@ -48,6 +55,9 @@ function! s:close_grep_job() abort
|
|||||||
if s:grepid != 0
|
if s:grepid != 0
|
||||||
call s:JOB.stop(s:grepid)
|
call s:JOB.stop(s:grepid)
|
||||||
endif
|
endif
|
||||||
|
if s:grep_timer_id != 0
|
||||||
|
call timer_stop(s:grep_timer_id)
|
||||||
|
endif
|
||||||
normal! "_ggdG
|
normal! "_ggdG
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user