|
3 | 3 | " Maintainer: skywind3000 (at) gmail.com, 2016-2023 |
4 | 4 | " Homepage: https://github.com/skywind3000/asyncrun.vim |
5 | 5 | " |
6 | | -" Last Modified: 2023/09/1918:47 |
| 6 | +" Last Modified: 2023/09/1923:48 |
7 | 7 | " |
8 | 8 | " Run shell command in background and output to quickfix: |
9 | 9 | " :AsyncRun[!] [options] {cmd} ... |
@@ -1074,7 +1074,7 @@ function! asyncrun#fullname(f) |
1074 | 1074 | letf=expand('%') |
1075 | 1075 | if &bt=='terminal' |
1076 | 1076 | letf='' |
1077 | | -elseif &bt=='nofile' |
| 1077 | +elseif &bt!='' |
1078 | 1078 | let is_directory=0 |
1079 | 1079 | iff=~'[\/\\]$' |
1080 | 1080 | iff=~'^[\/\\]'||f=~'^.:[\/\\]' |
@@ -1129,41 +1129,43 @@ function! s:path_join(home, name) |
1129 | 1129 | endif |
1130 | 1130 | endfunc |
1131 | 1131 |
|
1132 | | -" find project root |
1133 | | -function!s:find_root(path, markers, strict) |
1134 | | -function!s:guess_root(filename, markers) |
1135 | | -let fullname=asyncrun#fullname(a:filename) |
1136 | | -if fullname=~'^fugitive:/' |
1137 | | -ifexists('b:git_dir') |
1138 | | -returnfnamemodify(b:git_dir,':h') |
1139 | | -endif |
1140 | | -return''" skip any fugitive buffers early |
1141 | | -endif |
1142 | | -let pivot= fullname |
1143 | | -if!isdirectory(pivot) |
1144 | | -let pivot=fnamemodify(pivot,':h') |
1145 | | -endif |
1146 | | -while1 |
1147 | | -letprev= pivot |
1148 | | -for markerina:markers |
1149 | | -let newname=s:path_join(pivot, marker) |
1150 | | -if newname=~'[\*\?\[\]]' |
1151 | | -ifglob(newname)!='' |
1152 | | -return pivot |
1153 | | -endif |
1154 | | -elseiffilereadable(newname) |
1155 | | -return pivot |
1156 | | -elseifisdirectory(newname) |
| 1132 | +" guess root |
| 1133 | +function!s:guess_root(filename, markers) |
| 1134 | +let fullname=asyncrun#fullname(a:filename) |
| 1135 | +if fullname=~'^fugitive:/' |
| 1136 | +ifexists('b:git_dir') |
| 1137 | +returnfnamemodify(b:git_dir,':h') |
| 1138 | +endif |
| 1139 | +return''" skip any fugitive buffers early |
| 1140 | +endif |
| 1141 | +let pivot= fullname |
| 1142 | +if!isdirectory(pivot) |
| 1143 | +let pivot=fnamemodify(pivot,':h') |
| 1144 | +endif |
| 1145 | +while1 |
| 1146 | +letprev= pivot |
| 1147 | +for markerina:markers |
| 1148 | +let newname=s:path_join(pivot, marker) |
| 1149 | +if newname=~'[\*\?\[\]]' |
| 1150 | +ifglob(newname)!='' |
1157 | 1151 | return pivot |
1158 | 1152 | endif |
1159 | | -endfor |
1160 | | -let pivot=fnamemodify(pivot,':h') |
1161 | | -if pivot==prev |
1162 | | -break |
| 1153 | +elseiffilereadable(newname) |
| 1154 | +return pivot |
| 1155 | +elseifisdirectory(newname) |
| 1156 | +return pivot |
1163 | 1157 | endif |
1164 | | -endwhile |
1165 | | -return'' |
1166 | | -endfunc |
| 1158 | +endfor |
| 1159 | +let pivot=fnamemodify(pivot,':h') |
| 1160 | +if pivot==prev |
| 1161 | +break |
| 1162 | +endif |
| 1163 | +endwhile |
| 1164 | +return'' |
| 1165 | +endfunc |
| 1166 | + |
| 1167 | +" find project root |
| 1168 | +function!s:find_root(path, markers, strict) |
1167 | 1169 | ifa:path=='%' |
1168 | 1170 | ifexists('b:asyncrun_root')&&b:asyncrun_root!='' |
1169 | 1171 | returnb:asyncrun_root |
@@ -2272,7 +2274,7 @@ endfunc |
2272 | 2274 | " asyncrun - version |
2273 | 2275 | "---------------------------------------------------------------------- |
2274 | 2276 | function!asyncrun#version() |
2275 | | -return'2.11.21' |
| 2277 | +return'2.11.22' |
2276 | 2278 | endfunc |
2277 | 2279 |
|
2278 | 2280 |
|
|