Skip to content

Commit dfb55c9

Browse files
mhinzda-x
authored andcommitted
RustTest: support optional command modifiers
Examples: :topleft RustTest :belowright RustTest :tab RustTest :vert RustTest See `:h <mods>` for all supported command modifiers. You can specify multiple modifiers: :leftabove vert RustTest
1 parent 6d5f3d8 commit dfb55c9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

autoload/rust.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,16 +507,16 @@ function! s:SearchTestFunctionNameUnderCursor() abort
507507
return matchstr(getline(test_func_line), '\m\C^\s*fn\s\+\zs\h\w*')
508508
endfunction
509509

510-
function! rust#Test(all, options) abort
510+
function! rust#Test(mods, all, options) abort
511511
let manifest = findfile('Cargo.toml', expand('%:p:h') . ';')
512512
if manifest ==# ''
513513
return rust#Run(1, '--test ' . a:options)
514514
endif
515515

516516
if has('terminal')
517-
let cmd = 'terminal '
517+
let cmd = printf('%s terminal ', a:mods)
518518
elseif has('nvim')
519-
let cmd = 'noautocmd new | terminal '
519+
let cmd = printf('%s noautocmd new | terminal ', a:mods)
520520
else
521521
let cmd = '!'
522522
let manifest = shellescape(manifest)

ftplugin/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ command! -bar RustInfoToClipboard call rust#debugging#InfoToClipboard()
136136
command! -bar -nargs=1 RustInfoToFile call rust#debugging#InfoToFile(<f-args>)
137137

138138
" See |:RustTest| for docs
139-
command! -buffer -nargs=* -bang RustTest call rust#Test(<bang>0, <q-args>)
139+
command! -buffer -nargs=* -bang RustTest call rust#Test(<q-mods>, <bang>0, <q-args>)
140140

141141
if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args")
142142
let b:rust_last_rustc_args = []

0 commit comments

Comments
 (0)