Skip to content

Commit db0137d

Browse files
rhysdda-x
authored andcommitted
Add g:cargo_shell_command_runner to specify how to run cargo commands
fixes #376
1 parent a1dfe1d commit db0137d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

autoload/cargo.vim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
function! cargo#Load()
1+
function! cargo#Load()
22
" Utility call to get this script loaded, for debugging
33
endfunction
44

5-
function! cargo#cmd(args)
5+
function! cargo#cmd(args) abort
66
" Trim trailing spaces. This is necessary since :terminal command parses
77
" trailing spaces as an empty argument.
88
let args = substitute(a:args, '\s\+$', '', '')
9-
if has('terminal')
9+
if exists('g:cargo_shell_command_runner')
10+
let cmd = g:cargo_shell_command_runner
11+
elseif has('terminal')
1012
let cmd = 'terminal'
1113
elseif has('nvim')
1214
let cmd = 'noautocmd new | terminal'

doc/rust.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@ g:cargo_makeprg_params~
187187
let g:cargo_makeprg_params = 'build'
188188
<
189189

190+
*g:cargo_shell_command_runner*
191+
g:cargo_shell_command_runner~
192+
Set this option to change how to run shell commands for cargo commands
193+
|:Cargo|, |:Cbuild|, |:Crun|, ...
194+
By default, |:terminal| is used to run shell command in terminal window
195+
asynchronously. But if you prefer |:!| for running the commands, it can
196+
be specified: >
197+
let g:cargo_shell_command_runner = '!'
198+
<
199+
190200

191201
Integration with Syntastic *rust-syntastic*
192202
--------------------------

0 commit comments

Comments
 (0)