Skip to content

Commit 8935746

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 Allow to temporarily activate manual mode by :Copen 0
1 parent 6c59a31 commit 8935746

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

autoload/dispatch.vim

Lines changed: 8 additions & 1 deletion
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_temporary_quickfix_height = a:count
848848
elseif has_key(g:, 'dispatch_temporary_quickfix_height')
849849
unlet g:dispatch_temporary_quickfix_height
@@ -901,6 +901,13 @@ endfunction
901901
function! s:cwindow(request, all, copen)
902902
call s:cgetfile(a:request, a:all)
903903
let height = get(g:, 'dispatch_temporary_quickfix_height', get(g:, 'dispatch_quickfix_height', 10))
904+
if height <= 0
905+
if a:copen ==# -2
906+
" Show the user who explicitly called Copen that something was done
907+
echo 'QuickFix list updated'
908+
endif
909+
return
910+
endif
904911
let was_qf = s:is_quickfix()
905912
execute 'botright' (a:copen ? 'copen' : 'cwindow') height
906913
if !was_qf && s:is_quickfix() && a:copen !=# -2

plugin/dispatch.vim

Lines changed: 1 addition & 1 deletion
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)