3
3
" Maintainer: skywind3000 (at) gmail.com, 2016, 2017, 2018, 2019, 2020
4
4
" Homepage: http://www.vim.org/scripts/script.php?script_id=5431
5
5
"
6
- " Last Modified: 2020/02/16 00:47
6
+ " Last Modified: 2020/02/16 14:00
7
7
"
8
8
" Run shell command in background and output to quickfix:
9
9
" :AsyncRun[!] [options] {cmd} ...
@@ -652,20 +652,13 @@ function! s:AsyncRun_Job_Start(cmd)
652
652
call s: ErrorMsg (" empty arguments" )
653
653
return -3
654
654
endif
655
+ let l: args = []
655
656
if g: asyncrun_shell == ' '
656
- if ! executable (&shell )
657
- let l: text = " invalid config in &shell and &shellcmdflag"
658
- call s: ErrorMsg (l: text . " , &shell must be an executable." )
659
- return -4
660
- endif
661
- let l: args = [&shell , &shellcmdflag ]
657
+ let l: args += split (&shell )
658
+ let l: args += split (&shellcmdflag )
662
659
else
663
- if ! executable (g: asyncrun_shell )
664
- let l: text = " invalid config in g:asyncrun_shell"
665
- call s: ErrorMsg (l: text . " , it must be an executable." )
666
- return -4
667
- endif
668
- let l: args = [g: asyncrun_shell , g: asyncrun_shellflag ]
660
+ let l: args += split (g: asyncrun_shell )
661
+ let l: args += split (g: asyncrun_shellflag )
669
662
endif
670
663
let s: async_info .errorformat = s: async_efm
671
664
let l: name = []
@@ -675,7 +668,11 @@ function! s:AsyncRun_Job_Start(cmd)
675
668
let l: args += [a: cmd ]
676
669
else
677
670
let l: tmp = s: ScriptWrite (a: cmd , 0 )
678
- let l: args += [l: tmp ]
671
+ if s: async_nvim == 0
672
+ let l: args += [l: tmp ]
673
+ else
674
+ let l: args = shellescape (l: tmp )
675
+ endif
679
676
endif
680
677
elseif type (a: cmd ) == 3
681
678
if s: asyncrun_windows == 0
@@ -1522,13 +1519,16 @@ function! asyncrun#run(bang, opts, args, ...)
1522
1519
let l: macros [' VIM_RELNAME' ] = expand (" %:p:." )
1523
1520
let l: macros [' VIM_CWORD' ] = expand (" <cword>" )
1524
1521
let l: macros [' VIM_CFILE' ] = expand (" <cfile>" )
1522
+ let l: macros [' VIM_CLINE' ] = line (' .' )
1525
1523
let l: macros [' VIM_VERSION' ] = ' ' .v: version
1526
1524
let l: macros [' VIM_SVRNAME' ] = v: servername
1527
1525
let l: macros [' VIM_COLUMNS' ] = ' ' .&columns
1528
1526
let l: macros [' VIM_LINES' ] = ' ' .&lines
1529
1527
let l: macros [' VIM_GUI' ] = has (' gui_running' )? 1 : 0
1530
1528
let l: macros [' VIM_ROOT' ] = asyncrun#get_root (' %' )
1531
1529
let l: macros [' VIM_HOME' ] = expand (split (&rtp , ' ,' )[0 ])
1530
+ let l: macros [' VIM_PRONAME' ] = fnamemodify (l: macros [' VIM_ROOT' ], ' :t' )
1531
+ let l: macros [' VIM_DIRNAME' ] = fnamemodify (l: macros [' VIM_CWD' ], ' :t' )
1532
1532
let l: macros [' <cwd>' ] = l: macros [' VIM_CWD' ]
1533
1533
let l: macros [' <root>' ] = l: macros [' VIM_ROOT' ]
1534
1534
let l: retval = ' '
@@ -1579,6 +1579,7 @@ function! asyncrun#run(bang, opts, args, ...)
1579
1579
let l: macros [' VIM_RELDIR' ] = expand (" %:h:." )
1580
1580
let l: macros [' VIM_RELNAME' ] = expand (" %:p:." )
1581
1581
let l: macros [' VIM_CFILE' ] = expand (" <cfile>" )
1582
+ let l: macros [' VIM_DIRNAME' ] = fnamemodify (l: macros [' VIM_CWD' ], ' :t' )
1582
1583
let l: macros [' <cwd>' ] = l: macros [' VIM_CWD' ]
1583
1584
endif
1584
1585
@@ -1650,7 +1651,7 @@ endfunc
1650
1651
" asyncrun -version
1651
1652
" ----------------------------------------------------------------------
1652
1653
function ! asyncrun#version ()
1653
- return ' 2.4.2 '
1654
+ return ' 2.4.3 '
1654
1655
endfunc
1655
1656
1656
1657
0 commit comments