@@ -130,6 +130,13 @@ let g:asyncrun_stop = get(g:, 'asyncrun_stop', '')
130
130
" specify how to run your command
131
131
let g: asyncrun_mode = get (g: , ' asyncrun_mode' , 0 )
132
132
133
+ " Use quickfix-ID to allow concurrent use of quickfix list and not
134
+ " interleave streamed output of a running command with output from
135
+ " other plugins
136
+ if ! exists (' g:asyncrun_qf_id' )
137
+ let g: asyncrun_qf_id = has (' patch-8.0.1023' ) || has (' nvim-0.6.1' )
138
+ endif
139
+
133
140
" command hook
134
141
let g: asyncrun_hook = get (g: , ' asyncrun_hook' , ' ' )
135
142
@@ -431,16 +438,33 @@ function! s:AsyncRun_Job_Update(count, ...)
431
438
if once == 0
432
439
if l: text != ' '
433
440
if l: raw == 0
434
- if and (g: asyncrun_skip , 1 ) == 0
435
- caddexpr l: text
441
+ if exists (' s:qf_id' )
442
+ let qflist = {' id' : s: qf_id , ' lines' : split (l: text , " \n " )}
443
+ if and (g: asyncrun_skip , 1 ) == 0
444
+ call setqflist ([], ' a' , qflist)
445
+ else
446
+ noautocmd call setqflist ([], ' a' , qflist)
447
+ endif
436
448
else
437
- noautocmd caddexpr l: text
449
+ if and (g: asyncrun_skip , 1 ) == 0
450
+ caddexpr l: text
451
+ else
452
+ noautocmd caddexpr l: text
453
+ endif
438
454
endif
439
455
else
440
- call setqflist ([{' text' :l: text }], ' a' )
456
+ if exists (' s:qf_id' )
457
+ call setqflist ([], ' a' , {' id' : s: qf_id , ' items' : [{' text' :l: text }]})
458
+ else
459
+ call setqflist ([{' text' :l: text }], ' a' )
460
+ endif
441
461
endif
442
462
elseif g: asyncrun_trim == 0
443
- call setqflist (l: empty , ' a' )
463
+ if exists (' s:qf_id' )
464
+ call setqflist ([], ' a' , {' id' : s: qf_id , ' items' : l: empty })
465
+ else
466
+ call setqflist (l: empty , ' a' )
467
+ endif
444
468
endif
445
469
else
446
470
if l: text != ' '
@@ -568,20 +592,31 @@ function! s:AsyncRun_Job_OnFinish()
568
592
call timer_stop (s: async_timer )
569
593
unlet s: async_timer
570
594
endif
595
+ if exists (' s:qf_id' )
596
+ unlet s: qf_id
597
+ endif
571
598
call s: AsyncRun_Job_Update (-1 , s: async_info .once)
572
599
let l: current = localtime ()
573
600
let l: last = l: current - s: async_start
574
601
let l: check = s: AsyncRun_Job_CheckScroll ()
575
602
if s: async_code == 0
576
603
let l: text = " [Finished in " .l: last ." seconds]"
577
604
if ! s: async_info .strip
578
- call setqflist ([{' text' :l: text }], ' a' )
605
+ if exists (' s:qf_id' )
606
+ call setqflist ([], ' a' , {' id' : s: qf_id , ' items' : [{' text' :l: text }]})
607
+ else
608
+ call setqflist ([{' text' :l: text }], ' a' )
609
+ endif
579
610
endif
580
611
let g: asyncrun_status = " success"
581
612
else
582
613
let l: text = ' with code ' .s: async_code
583
614
let l: text = " [Finished in " .l: last ." seconds " .l: text ." ]"
584
- call setqflist ([{' text' :l: text }], ' a' )
615
+ if exists (' s:qf_id' )
616
+ call setqflist ([], ' a' , {' id' : s: qf_id , ' lines' : [l: text ]})
617
+ else
618
+ call setqflist ([{' text' :l: text }], ' a' )
619
+ endif
585
620
let g: asyncrun_status = " failure"
586
621
endif
587
622
let s: async_state = 0
@@ -842,8 +877,15 @@ function! s:AsyncRun_Job_Start(cmd)
842
877
call setqflist ([], ' ' , l: title )
843
878
endif
844
879
endif
880
+ if g: asyncrun_qf_id == 1
881
+ let s: qf_id = getqflist ({' id' :0 }).id
882
+ endif
845
883
if ! s: async_info .strip
846
- call setqflist ([{' text' :l: arguments }], ' a' )
884
+ if exists (' s:qf_id' )
885
+ call setqflist ([], ' a' , {' id' : s: qf_id , ' lines' : [l: arguments ]})
886
+ else
887
+ call setqflist ([{' text' :l: arguments }], ' a' )
888
+ endif
847
889
endif
848
890
let l: name = ' g:AsyncRun_Job_OnTimer'
849
891
let s: async_timer = timer_start (100 , l: name , {' repeat' :-1 })
0 commit comments