|
1 | 1 | " asyncrun.vim - Run shell commands in background and output to quickfix
|
2 | 2 | "
|
3 |
| -" Maintainer: skywind3000 (at) gmail.com, 2016-2022 |
| 3 | +" Maintainer: skywind3000 (at) gmail.com, 2016-2023 |
4 | 4 | " Homepage: https://github.com/skywind3000/asyncrun.vim
|
5 | 5 | "
|
6 |
| -" Last Modified: 2022/11/29 07:05 |
| 6 | +" Last Modified: 2023/01/18 19:58 |
7 | 7 | "
|
8 | 8 | " Run shell command in background and output to quickfix:
|
9 | 9 | " :AsyncRun[!] [options] {cmd} ...
|
@@ -1716,6 +1716,13 @@ function! s:run(opts)
|
1716 | 1716 |
|
1717 | 1717 | let l:mode = get(l:modemap, l:mode, l:mode)
|
1718 | 1718 |
|
| 1719 | + " alias "-runner=name" to "-mode=term -pos=name" |
| 1720 | + if get(l:opts, 'runner', '') != '' |
| 1721 | + let l:opts.pos = get(l:opts, 'runner', '') |
| 1722 | + let l:opts.mode = 6 |
| 1723 | + let l:mode = 6 |
| 1724 | + endif |
| 1725 | + |
1719 | 1726 | " alias "-mode=raw" to "-mode=async -raw=1"
|
1720 | 1727 | if type(l:mode) == type('') && l:mode == 'raw'
|
1721 | 1728 | let l:mode = 0
|
@@ -1781,14 +1788,8 @@ function! s:run(opts)
|
1781 | 1788 | let test = ['cygwin', 'msys', 'mingw32', 'mingw64']
|
1782 | 1789 | let test += ['clang64', 'clang32']
|
1783 | 1790 | if has_key(g:asyncrun_program, name) != 0
|
1784 |
| - let l:F = g:asyncrun_program[name] |
1785 |
| - if type(l:F) == type('') |
1786 |
| - let t = l:F |
1787 |
| - unlet l:F |
1788 |
| - let l:F = function(t) |
1789 |
| - endif |
1790 |
| - unsilent let l:command = l:F(l:opts) |
1791 |
| - unlet l:F |
| 1791 | + unsilent let hr = call call(g:asyncrun_program[name], [l:opts]) |
| 1792 | + unsilent let l:command = hr |
1792 | 1793 | elseif index(test, name) >= 0
|
1793 | 1794 | unsilent let l:command = s:program_msys(l:opts)
|
1794 | 1795 | else
|
@@ -1840,17 +1841,14 @@ function! s:run(opts)
|
1840 | 1841 | exec strpart(t, 1)
|
1841 | 1842 | return ''
|
1842 | 1843 | elseif l:runner != ''
|
1843 |
| - let l:F = g:asyncrun_runner[l:runner] |
1844 |
| - if type(l:F) == type('') |
1845 |
| - let l:t = l:F |
1846 |
| - unlet l:F |
1847 |
| - let l:F = function(l:t) |
1848 |
| - endif |
1849 | 1844 | let obj = deepcopy(l:opts)
|
1850 | 1845 | let obj.cmd = command
|
1851 | 1846 | let obj.src = a:opts.cmd
|
1852 |
| - call l:F(obj) |
1853 |
| - unlet l:F |
| 1847 | + if has_key(g:asyncrun_runner, l:runner) |
| 1848 | + call call(g:asyncrun_runner[l:runner], [obj]) |
| 1849 | + else |
| 1850 | + call s:ErrorMsg(l:runner . " not found in g:asyncrun_runner") |
| 1851 | + endif |
1854 | 1852 | return ''
|
1855 | 1853 | endif
|
1856 | 1854 |
|
@@ -2239,7 +2237,7 @@ endfunc
|
2239 | 2237 | " asyncrun - version
|
2240 | 2238 | "----------------------------------------------------------------------
|
2241 | 2239 | function! asyncrun#version()
|
2242 |
| - return '2.11.14' |
| 2240 | + return '2.11.15' |
2243 | 2241 | endfunc
|
2244 | 2242 |
|
2245 | 2243 |
|
|
0 commit comments