Skip to content

Commit 99b5025

Browse files
author
skywind3000
committed
Added handling for fugitive buffers in asyncrun#fullname() function
1 parent 61cc308 commit 99b5025

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

plugin/asyncrun.vim

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" asyncrun.vim - Run shell commands in background and output to quickfix
22
"
3-
" Maintainer: skywind3000 (at) gmail.com, 2016-2023
3+
" Maintainer: skywind3000 (at) gmail.com, 2016-2024
44
" Homepage: https://github.com/skywind3000/asyncrun.vim
55
"
6-
" Last Modified: 2023/09/25 23:19
6+
" Last Modified: 2024/02/16 11:36
77
"
88
" Run shell command in background and output to quickfix:
99
" :AsyncRun[!] [options] {cmd} ...
@@ -1083,7 +1083,9 @@ function! asyncrun#fullname(f)
10831083
let f = ''
10841084
elseif &bt != ''
10851085
let is_directory = 0
1086-
if f =~ '[\/\\]$'
1086+
if f =~ '\v^fugitive\:[\\\/][\\\/][\\\/]'
1087+
return asyncrun#fullname(f)
1088+
elseif f =~ '[\/\\]$'
10871089
if f =~ '^[\/\\]' || f =~ '^.:[\/\\]'
10881090
let is_directory = isdirectory(f)
10891091
endif
@@ -1092,6 +1094,13 @@ function! asyncrun#fullname(f)
10921094
endif
10931095
elseif f =~ '^\~[\/\\]'
10941096
let f = expand(f)
1097+
elseif f =~ '\v^fugitive\:[\\\/][\\\/][\\\/]'
1098+
let path = strpart(f, s:asyncrun_windows? 12 : 11)
1099+
let pos = stridx(path, '.git')
1100+
if pos >= 0
1101+
let path = strpart(path, 0, pos)
1102+
endif
1103+
let f = fnamemodify(path, ':h')
10951104
endif
10961105
let f = fnamemodify(f, ':p')
10971106
if s:asyncrun_windows
@@ -1139,12 +1148,6 @@ endfunc
11391148
" guess root
11401149
function! s:guess_root(filename, markers)
11411150
let fullname = asyncrun#fullname(a:filename)
1142-
if fullname =~ '^fugitive:/'
1143-
if exists('b:git_dir')
1144-
return fnamemodify(b:git_dir, ':h')
1145-
endif
1146-
return '' " skip any fugitive buffers early
1147-
endif
11481151
let pivot = fullname
11491152
if !isdirectory(pivot)
11501153
let pivot = fnamemodify(pivot, ':h')
@@ -2295,7 +2298,7 @@ endfunc
22952298
" asyncrun - version
22962299
"----------------------------------------------------------------------
22972300
function! asyncrun#version()
2298-
return '2.12.2'
2301+
return '2.12.3'
22992302
endfunc
23002303

23012304

0 commit comments

Comments
 (0)