Skip to content

Commit dacc708

Browse files
author
skywind3000
committed
remove $(VIM_WORKSPACE)/<workspace>, attempt to reed project root from (b:|t:|g:)asyncrun_root
1 parent 80e0e37 commit dacc708

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

plugin/asyncrun.vim

Lines changed: 11 additions & 27 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/04/08 02:58
6+
" Last Modified: 2020/04/09 09:59
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -43,7 +43,6 @@
4343
" $VIM_MODE - Execute via 0:!, 1:makeprg, 2:system(), 3:silent
4444
" $VIM_COLUMNS - How many columns in vim's screen
4545
" $VIM_LINES - How many lines in vim's screen
46-
" $VIM_WORKSPACE - Current workspace folder
4746
"
4847
" Parameters also accept these environment variables wrapped by
4948
" "$(...)", and "$(VIM_FILEDIR)" will be expanded as file directory.
@@ -1009,9 +1008,6 @@ endfunc
10091008
function! s:find_root(path, markers, strict)
10101009
function! s:guess_root(filename, markers)
10111010
let fullname = asyncrun#fullname(a:filename)
1012-
if exists('b:asyncrun_root')
1013-
return b:asyncrun_root
1014-
endif
10151011
if fullname =~ '^fugitive:/'
10161012
if exists('b:git_dir')
10171013
return fnamemodify(b:git_dir, ':h')
@@ -1043,6 +1039,15 @@ function! s:find_root(path, markers, strict)
10431039
endwhile
10441040
return ''
10451041
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
10461051
let root = s:guess_root(a:path, a:markers)
10471052
if root != ''
10481053
return asyncrun#fullname(root)
@@ -1678,25 +1683,6 @@ function! s:run(opts)
16781683
endfunc
16791684

16801685

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-
17001686
"----------------------------------------------------------------------
17011687
" asyncrun - run
17021688
"----------------------------------------------------------------------
@@ -1724,11 +1710,9 @@ function! asyncrun#run(bang, opts, args, ...)
17241710
let l:macros['VIM_HOME'] = expand(split(&rtp, ',')[0])
17251711
let l:macros['VIM_PRONAME'] = fnamemodify(l:macros['VIM_ROOT'], ':t')
17261712
let l:macros['VIM_DIRNAME'] = fnamemodify(l:macros['VIM_CWD'], ':t')
1727-
let l:macros['VIM_WORKSPACE'] = asyncrun#workspace()
17281713
let l:macros['VIM_PWD'] = l:macros['VIM_CWD']
17291714
let l:macros['<cwd>'] = l:macros['VIM_CWD']
17301715
let l:macros['<root>'] = l:macros['VIM_ROOT']
1731-
let l:macros['<workspace>'] = l:macros['VIM_WORKSPACE']
17321716
let l:macros['<pwd>'] = l:macros['VIM_PWD']
17331717
let l:retval = ''
17341718

@@ -1876,7 +1860,7 @@ endfunc
18761860
" asyncrun - version
18771861
"----------------------------------------------------------------------
18781862
function! asyncrun#version()
1879-
return '2.7.3'
1863+
return '2.7.4'
18801864
endfunc
18811865

18821866

0 commit comments

Comments
 (0)