Skip to content

Commit c8bd3c3

Browse files
author
skywind3000
committed
Update asyncrun plugin version to 2.12.4 and add a new root locator functionality.
1 parent 99b5025 commit c8bd3c3

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

autoload/asyncrun/locator.vim

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"======================================================================
2+
"
3+
" locator.vim -
4+
"
5+
" Created by skywind on 2024/02/20
6+
" Last Modified: 2024/02/20 21:02:29
7+
"
8+
"======================================================================
9+
10+
11+
"----------------------------------------------------------------------
12+
" root locator
13+
"----------------------------------------------------------------------
14+
function! asyncrun#locator#detect()
15+
return ''
16+
endfunc
17+
18+

plugin/asyncrun.vim

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: skywind3000 (at) gmail.com, 2016-2024
44
" Homepage: https://github.com/skywind3000/asyncrun.vim
55
"
6-
" Last Modified: 2024/02/16 11:36
6+
" Last Modified: 2024/02/20 21:17
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -1183,6 +1183,11 @@ function! s:find_root(path, markers, strict)
11831183
return t:asyncrun_root
11841184
elseif exists('g:asyncrun_root') && g:asyncrun_root != ''
11851185
return g:asyncrun_root
1186+
elseif exists('g:asyncrun_locator')
1187+
let root = call(g:asyncrun_locator, [])
1188+
if root != ''
1189+
return root
1190+
endif
11861191
endif
11871192
endif
11881193
let root = s:guess_root(a:path, a:markers)
@@ -2298,7 +2303,7 @@ endfunc
22982303
" asyncrun - version
22992304
"----------------------------------------------------------------------
23002305
function! asyncrun#version()
2301-
return '2.12.3'
2306+
return '2.12.4'
23022307
endfunc
23032308

23042309

plugin/script_load.vim

+29
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,32 @@ function! g:asyncrun_event.program(name)
107107
endfunc
108108

109109

110+
"----------------------------------------------------------------------
111+
" detect current root
112+
"----------------------------------------------------------------------
113+
function! s:root_locator()
114+
let root = ''
115+
if exists('g:asyncrun_rooter')
116+
if type(g:asyncrun_rooter) == type('')
117+
let root = call(g:asyncrun_rooter, [])
118+
elseif type(g:asyncrun_rooter) == type({})
119+
let test = keys(g:asyncrun_rooter)
120+
call sort(test)
121+
for name in test
122+
let root = call(g:asyncrun_rooter, [])
123+
if root != ''
124+
return root
125+
endif
126+
endfor
127+
endif
128+
if root != ''
129+
return root
130+
endif
131+
endif
132+
return asyncrun#locator#detect()
133+
endfunc
134+
135+
136+
let g:asyncrun_locator = string(function('s:root_locator'))[10:-3]
137+
138+

0 commit comments

Comments
 (0)