Skip to content

Commit c88f1b1

Browse files
committed
Capture <mods> in request
References: #250
1 parent ed95386 commit c88f1b1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

autoload/dispatch.vim

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,15 @@ function! s:focus(count) abort
479479
endif
480480
endfunction
481481

482-
function! dispatch#spawn_command(bang, command, count, ...) abort
482+
function! dispatch#spawn_command(bang, command, count, mods, ...) abort
483483
let [command, opts] = s:extract_opts(a:command)
484484
if empty(command) && a:count >= 0
485485
let command = s:focus(a:count)
486486
call extend(opts, {'wait': 'always'}, 'keep')
487487
let [command, opts] = s:extract_opts(command, opts)
488488
endif
489489
let opts.background = a:bang
490+
let opts.mods = a:mods ==# '<mods>' ? '' : a:mods
490491
call dispatch#spawn(command, opts, a:count)
491492
return ''
492493
endfunction
@@ -526,9 +527,10 @@ function! s:parse_start(command, count) abort
526527
return [command, opts]
527528
endfunction
528529

529-
function! dispatch#start_command(bang, command, count, ...) abort
530+
function! dispatch#start_command(bang, command, count, mods, ...) abort
530531
let [command, opts] = s:parse_start(a:command, a:count)
531532
let opts.background = get(opts, 'background') || a:bang
533+
let opts.mods = a:mods ==# '<mods>' ? '' : a:mods
532534
if command =~# '^:\S'
533535
unlet! g:dispatch_last_start
534536
return s:wrapcd(get(opts, 'directory', getcwd()),
@@ -555,6 +557,7 @@ function! dispatch#spawn(command, ...) abort
555557
\ 'command': command,
556558
\ 'directory': getcwd(),
557559
\ 'title': '',
560+
\ 'mods': '',
558561
\ }, a:0 ? a:1 : {})
559562
if empty(a:command)
560563
call extend(request, {'wait': 'never'}, 'keep')
@@ -811,8 +814,8 @@ if !exists('s:makes')
811814
let s:files = {}
812815
endif
813816

814-
function! dispatch#compile_command(bang, args, count, ...) abort
815-
let [args, request] = s:extract_opts(a:args)
817+
function! dispatch#compile_command(bang, args, count, mods, ...) abort
818+
let [args, request] = s:extract_opts(a:args, {'mods': a:mods ==# '<mods>' ? '' : a:mods})
816819

817820
if empty(args)
818821
let default_dispatch = 1

0 commit comments

Comments
 (0)