Skip to content

Commit 6c59a31

Browse files
committed
Add a count to Copen to set quickfix height
1 parent 14a1695 commit 6c59a31

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

autoload/dispatch.vim

+7-2
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,12 @@ endfunction
842842
" }}}1
843843
" Quickfix window {{{1
844844

845-
function! dispatch#copen(bang) abort
845+
function! dispatch#copen(bang, count) abort
846+
if a:count != 0
847+
let g:dispatch_temporary_quickfix_height = a:count
848+
elseif has_key(g:, 'dispatch_temporary_quickfix_height')
849+
unlet g:dispatch_temporary_quickfix_height
850+
endif
846851
if empty(s:makes)
847852
return 'echoerr ' . string('No dispatches yet')
848853
endif
@@ -895,7 +900,7 @@ endfunction
895900

896901
function! s:cwindow(request, all, copen)
897902
call s:cgetfile(a:request, a:all)
898-
let height = get(g:, 'dispatch_quickfix_height', 10)
903+
let height = get(g:, 'dispatch_temporary_quickfix_height', get(g:, 'dispatch_quickfix_height', 10))
899904
let was_qf = s:is_quickfix()
900905
execute 'botright' (a:copen ? 'copen' : 'cwindow') height
901906
if !was_qf && s:is_quickfix() && a:copen !=# -2

autoload/dispatch/tmux.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function! dispatch#tmux#make(request) abort
4848
\ . ' > ' . a:request.file . '.complete'] : [])))
4949

5050
let title = shellescape(get(a:request, 'title', get(a:request, 'compiler', 'make')))
51-
let height = get(g:, 'dispatch_tmux_height', get(g:, 'dispatch_quickfix_height', 10))
51+
let height = get(g:, 'dispatch_tmux_height', get(g:, 'dispatch_temporary_quickfix_height', get(g:, 'dispatch_quickfix_height', 10)))
5252
if get(a:request, 'background', 0)
5353
let cmd = 'new-window -d -n '.title
5454
elseif has('gui_running') || empty($TMUX) || (!empty(''.session) && session !=# system('tmux display-message -p "#S"')[0:-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 -bar Copen call dispatch#copen(<bang>0)
28+
command! -bang -count -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)