Skip to content

Commit 02ff483

Browse files
author
skywind3000
committed
fixed: -mode=term -safe=1 may fail when home directory contains spaces.
1 parent 3fedd42 commit 02ff483

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugin/asyncrun.vim

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: skywind3000 (at) gmail.com, 2016, 2017, 2018, 2019, 2020
44
" Homepage: http://www.vim.org/scripts/script.php?script_id=5431
55
"
6-
" Last Modified: 2020/02/16 14:00
6+
" Last Modified: 2020/02/16 21:32
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -1086,6 +1086,9 @@ function! s:start_in_terminal(opts)
10861086
endif
10871087
if get(a:opts, 'safe', get(g:, 'asyncrun_term_safe', 0)) != 0
10881088
let command = s:ScriptWrite(a:opts.command, 0)
1089+
if stridx(command, ' ') >= 0
1090+
let command = shellescape(command)
1091+
endif
10891092
let shell = ''
10901093
endif
10911094
let avail = -1
@@ -1533,6 +1536,11 @@ function! asyncrun#run(bang, opts, args, ...)
15331536
let l:macros['<root>'] = l:macros['VIM_ROOT']
15341537
let l:retval = ''
15351538

1539+
" handle: empty extension
1540+
if expand("%:e") == ''
1541+
let l:macros['VIM_FILEEXT'] = ''
1542+
endif
1543+
15361544
" extract options
15371545
let [l:command, l:opts] = s:ExtractOpt(s:StringStrip(a:args))
15381546

@@ -1651,7 +1659,7 @@ endfunc
16511659
" asyncrun -version
16521660
"----------------------------------------------------------------------
16531661
function! asyncrun#version()
1654-
return '2.4.3'
1662+
return '2.4.4'
16551663
endfunc
16561664

16571665

0 commit comments

Comments
 (0)