Skip to content

Commit 34d0671

Browse files
author
skywind3000
committed
2.7.9:
new: use '-mode=wait' for 'system()' new: add autocmd AsyncRunPre, AsyncRunStart, AsyncRunStop for '-mode=wait'
1 parent 18c5a60 commit 34d0671

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plugin/asyncrun.vim

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: skywind3000 (at) gmail.com, 2016, 2017, 2018, 2019, 2020
44
" Homepage: http://www.vim.org/scripts/script.php?script_id=5431
55
"
6-
" Last Modified: 2021/01/12 19:44
6+
" Last Modified: 2021/01/28 18:02
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -1387,6 +1387,7 @@ function! s:run(opts)
13871387
let l:modemap['external'] = 4
13881388
let l:modemap['quickfix'] = 0
13891389
let l:modemap['vim'] = 2
1390+
let l:modemap['wait'] = 3
13901391

13911392
let l:mode = get(l:modemap, l:mode, l:mode)
13921393

@@ -1599,6 +1600,11 @@ function! s:run(opts)
15991600
call s:AutoCmd('Stop')
16001601
endif
16011602
elseif l:mode == 3
1603+
let autocmd = get(opts, 'autocmd', 0)
1604+
if autocmd != 0
1605+
call s:AutoCmd('Pre')
1606+
call s:AutoCmd('Start')
1607+
endif
16021608
if s:asyncrun_windows == 0
16031609
let l:retval = system(l:command)
16041610
let g:asyncrun_shell_error = v:shell_error
@@ -1651,6 +1657,9 @@ function! s:run(opts)
16511657
if opts.post != ''
16521658
exec opts.post
16531659
endif
1660+
if autocmd != 0
1661+
call s:AutoCmd('Stop')
1662+
endif
16541663
elseif l:mode <= 5
16551664
let script = get(g:, 'asyncrun_script', '')
16561665
if script != '' && l:mode == 4
@@ -1868,7 +1877,7 @@ endfunc
18681877
" asyncrun - version
18691878
"----------------------------------------------------------------------
18701879
function! asyncrun#version()
1871-
return '2.7.8'
1880+
return '2.7.9'
18721881
endfunc
18731882

18741883

0 commit comments

Comments
 (0)