Skip to content

Commit

Permalink
Add a count to Copen to set quickfix height
Browse files Browse the repository at this point in the history
  • Loading branch information
shym committed Jul 19, 2017
1 parent 14a1695 commit 6c59a31
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions autoload/dispatch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,12 @@ endfunction
" }}}1
" Quickfix window {{{1

function! dispatch#copen(bang) abort
function! dispatch#copen(bang, count) abort
if a:count != 0
let g:dispatch_temporary_quickfix_height = a:count
elseif has_key(g:, 'dispatch_temporary_quickfix_height')
unlet g:dispatch_temporary_quickfix_height
endif
if empty(s:makes)
return 'echoerr ' . string('No dispatches yet')
endif
Expand Down Expand Up @@ -895,7 +900,7 @@ endfunction

function! s:cwindow(request, all, copen)
call s:cgetfile(a:request, a:all)
let height = get(g:, 'dispatch_quickfix_height', 10)
let height = get(g:, 'dispatch_temporary_quickfix_height', get(g:, 'dispatch_quickfix_height', 10))
let was_qf = s:is_quickfix()
execute 'botright' (a:copen ? 'copen' : 'cwindow') height
if !was_qf && s:is_quickfix() && a:copen !=# -2
Expand Down
2 changes: 1 addition & 1 deletion autoload/dispatch/tmux.vim
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function! dispatch#tmux#make(request) abort
\ . ' > ' . a:request.file . '.complete'] : [])))

let title = shellescape(get(a:request, 'title', get(a:request, 'compiler', 'make')))
let height = get(g:, 'dispatch_tmux_height', get(g:, 'dispatch_quickfix_height', 10))
let height = get(g:, 'dispatch_tmux_height', get(g:, 'dispatch_temporary_quickfix_height', get(g:, 'dispatch_quickfix_height', 10)))
if get(a:request, 'background', 0)
let cmd = 'new-window -d -n '.title
elseif has('gui_running') || empty($TMUX) || (!empty(''.session) && session !=# system('tmux display-message -p "#S"')[0:-2])
Expand Down
2 changes: 1 addition & 1 deletion plugin/dispatch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ command! -bang -nargs=* -complete=customlist,dispatch#command_complete Spawn
command! -bang -nargs=* -complete=customlist,dispatch#command_complete Start
\ execute dispatch#start_command(<bang>0, <q-args>)

command! -bang -bar Copen call dispatch#copen(<bang>0)
command! -bang -count -bar Copen call dispatch#copen(<bang>0, <count>)

function! DispatchComplete(id) abort
return dispatch#complete(a:id)
Expand Down

0 comments on commit 6c59a31

Please sign in to comment.