Skip to content

Commit ccd83bd

Browse files
author
skywind3000
committed
1. g:asyncrun_rootmarks accepts wildcards
2. '-reuse=0' can be used in split terminal
1 parent 062558a commit ccd83bd

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

plugin/asyncrun.vim

Lines changed: 24 additions & 13 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/03/12 18:54
6+
" Last Modified: 2020/03/22 15:54
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -987,17 +987,17 @@ endfunc
987987

988988
" find project root
989989
function! s:find_root(path, markers, strict)
990-
function! s:guess_root(filename, markers)
991-
let fullname = asyncrun#fullname(a:filename)
992-
if exists('b:asyncrun_root')
990+
function! s:guess_root(filename, markers)
991+
let fullname = asyncrun#fullname(a:filename)
992+
if exists('b:asyncrun_root')
993993
return b:asyncrun_root
994-
endif
995-
if fullname =~ '^fugitive:/'
996-
if exists('b:git_dir')
997-
return fnamemodify(b:git_dir, ':h')
998-
endif
999-
return '' " skip any fugitive buffers early
1000-
endif
994+
endif
995+
if fullname =~ '^fugitive:/'
996+
if exists('b:git_dir')
997+
return fnamemodify(b:git_dir, ':h')
998+
endif
999+
return '' " skip any fugitive buffers early
1000+
endif
10011001
let pivot = fullname
10021002
if !isdirectory(pivot)
10031003
let pivot = fnamemodify(pivot, ':h')
@@ -1006,7 +1006,15 @@ function! s:find_root(path, markers, strict)
10061006
let prev = pivot
10071007
for marker in a:markers
10081008
let newname = s:path_join(pivot, marker)
1009-
if filereadable(newname)
1009+
if stridx(newname, '*') >= 0 || stridx(newname, '?') >= 0
1010+
if glob(newname) != ''
1011+
return pivot
1012+
endif
1013+
elseif stridx(newname, '[') >= 0 || stridx(newname, ']') >= 0
1014+
if glob(newname) != ''
1015+
return pivot
1016+
endif
1017+
elseif filereadable(newname)
10101018
return pivot
10111019
elseif isdirectory(newname)
10121020
return pivot
@@ -1238,6 +1246,9 @@ function! s:start_in_terminal(opts)
12381246
endif
12391247
endif
12401248
endif
1249+
if get(a:opts, 'reuse', 1) == 0
1250+
let avail = -1
1251+
endif
12411252
endfor
12421253
let focus = get(a:opts, 'focus', 1)
12431254
if pos ==? 'tab'
@@ -1829,7 +1840,7 @@ endfunc
18291840
" asyncrun - version
18301841
"----------------------------------------------------------------------
18311842
function! asyncrun#version()
1832-
return '2.6.7'
1843+
return '2.6.8'
18331844
endfunc
18341845

18351846

0 commit comments

Comments
 (0)