|
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/04/08 02:58 |
| 6 | +" Last Modified: 2020/04/09 09:59 |
7 | 7 | "
|
8 | 8 | " Run shell command in background and output to quickfix:
|
9 | 9 | " :AsyncRun[!] [options] {cmd} ...
|
|
43 | 43 | " $VIM_MODE - Execute via 0:!, 1:makeprg, 2:system(), 3:silent
|
44 | 44 | " $VIM_COLUMNS - How many columns in vim's screen
|
45 | 45 | " $VIM_LINES - How many lines in vim's screen
|
46 |
| -" $VIM_WORKSPACE - Current workspace folder |
47 | 46 | "
|
48 | 47 | " Parameters also accept these environment variables wrapped by
|
49 | 48 | " "$(...)", and "$(VIM_FILEDIR)" will be expanded as file directory.
|
@@ -1009,9 +1008,6 @@ endfunc
|
1009 | 1008 | function! s:find_root(path, markers, strict)
|
1010 | 1009 | function! s:guess_root(filename, markers)
|
1011 | 1010 | let fullname = asyncrun#fullname(a:filename)
|
1012 |
| - if exists('b:asyncrun_root') |
1013 |
| - return b:asyncrun_root |
1014 |
| - endif |
1015 | 1011 | if fullname =~ '^fugitive:/'
|
1016 | 1012 | if exists('b:git_dir')
|
1017 | 1013 | return fnamemodify(b:git_dir, ':h')
|
@@ -1043,6 +1039,15 @@ function! s:find_root(path, markers, strict)
|
1043 | 1039 | endwhile
|
1044 | 1040 | return ''
|
1045 | 1041 | endfunc
|
| 1042 | + if a:path == '%' || a:path == '' |
| 1043 | + if exists('b:asyncrun_root') && b:asyncrun_root != '' |
| 1044 | + return b:asyncrun_root |
| 1045 | + elseif exists('t:asyncrun_root') && t:asyncrun_root != '' |
| 1046 | + return t:asyncrun_root |
| 1047 | + elseif exists('g:asyncrun_root') && g:asyncrun_root != '' |
| 1048 | + return g:asyncrun_root |
| 1049 | + endif |
| 1050 | + endif |
1046 | 1051 | let root = s:guess_root(a:path, a:markers)
|
1047 | 1052 | if root != ''
|
1048 | 1053 | return asyncrun#fullname(root)
|
@@ -1678,25 +1683,6 @@ function! s:run(opts)
|
1678 | 1683 | endfunc
|
1679 | 1684 |
|
1680 | 1685 |
|
1681 |
| -"---------------------------------------------------------------------- |
1682 |
| -" get workspace |
1683 |
| -"---------------------------------------------------------------------- |
1684 |
| -function! asyncrun#workspace() |
1685 |
| - let workspace = '' |
1686 |
| - if exists('b:asyncrun_workspace') |
1687 |
| - let workspace = b:asyncrun_workspace |
1688 |
| - elseif exists('t:asyncrun_workspace') |
1689 |
| - let workspace = t:asyncrun_workspace |
1690 |
| - elseif exists('g:asyncrun_workspace') |
1691 |
| - let workspace = g:asyncrun_workspace |
1692 |
| - endif |
1693 |
| - if workspace == '-' |
1694 |
| - return getcwd() |
1695 |
| - endif |
1696 |
| - return (workspace != '')? workspace : getcwd() |
1697 |
| -endfunc |
1698 |
| - |
1699 |
| - |
1700 | 1686 | "----------------------------------------------------------------------
|
1701 | 1687 | " asyncrun - run
|
1702 | 1688 | "----------------------------------------------------------------------
|
@@ -1724,11 +1710,9 @@ function! asyncrun#run(bang, opts, args, ...)
|
1724 | 1710 | let l:macros['VIM_HOME'] = expand(split(&rtp, ',')[0])
|
1725 | 1711 | let l:macros['VIM_PRONAME'] = fnamemodify(l:macros['VIM_ROOT'], ':t')
|
1726 | 1712 | let l:macros['VIM_DIRNAME'] = fnamemodify(l:macros['VIM_CWD'], ':t')
|
1727 |
| - let l:macros['VIM_WORKSPACE'] = asyncrun#workspace() |
1728 | 1713 | let l:macros['VIM_PWD'] = l:macros['VIM_CWD']
|
1729 | 1714 | let l:macros['<cwd>'] = l:macros['VIM_CWD']
|
1730 | 1715 | let l:macros['<root>'] = l:macros['VIM_ROOT']
|
1731 |
| - let l:macros['<workspace>'] = l:macros['VIM_WORKSPACE'] |
1732 | 1716 | let l:macros['<pwd>'] = l:macros['VIM_PWD']
|
1733 | 1717 | let l:retval = ''
|
1734 | 1718 |
|
@@ -1876,7 +1860,7 @@ endfunc
|
1876 | 1860 | " asyncrun - version
|
1877 | 1861 | "----------------------------------------------------------------------
|
1878 | 1862 | function! asyncrun#version()
|
1879 |
| - return '2.7.3' |
| 1863 | + return '2.7.4' |
1880 | 1864 | endfunc
|
1881 | 1865 |
|
1882 | 1866 |
|
|
0 commit comments