Skip to content

Commit 5b9fc8b

Browse files
committed
Skip automatic copen when height <= 0
copen and cwindow expect a positive number for the window height so we can use the value 0 to state that the quickfix window should not be opened or closed automatically With that setting, `:Copen 0` updates the quickfix list without opening the quickfix window and prevents the quickfix window from opening on completion of a `:Dispatch` until the next explicit `:Copen`
1 parent 2d07f31 commit 5b9fc8b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

autoload/dispatch.vim

+4-1
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ endfunction
843843
" Quickfix window {{{1
844844

845845
function! dispatch#copen(bang, count) abort
846-
if a:count != 0
846+
if a:count != 9999999
847847
let g:dispatch_quickfix_height = a:count
848848
elseif has_key(g:, 'dispatch_quickfix_height')
849849
unlet g:dispatch_quickfix_height
@@ -901,6 +901,9 @@ endfunction
901901
function! s:cwindow(request, all, copen)
902902
call s:cgetfile(a:request, a:all)
903903
let height = get(g:, 'dispatch_quickfix_height', 10)
904+
if height <= 0
905+
return
906+
endif
904907
let was_qf = s:is_quickfix()
905908
execute 'botright' (a:copen ? 'copen' : 'cwindow') height
906909
if !was_qf && s:is_quickfix() && a:copen !=# -2

plugin/dispatch.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ command! -bang -nargs=* -complete=customlist,dispatch#command_complete Spawn
2525
command! -bang -nargs=* -complete=customlist,dispatch#command_complete Start
2626
\ execute dispatch#start_command(<bang>0, <q-args>)
2727

28-
command! -bang -count -bar Copen call dispatch#copen(<bang>0, <count>)
28+
command! -bang -count=9999999 -bar Copen call dispatch#copen(<bang>0, <count>)
2929

3030
function! DispatchComplete(id) abort
3131
return dispatch#complete(a:id)

0 commit comments

Comments
 (0)