Skip to content

Commit

Permalink
Added handling for fugitive buffers in asyncrun#fullname() function
Browse files Browse the repository at this point in the history
  • Loading branch information
skywind3000 committed Feb 16, 2024
1 parent 61cc308 commit 99b5025
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions plugin/asyncrun.vim
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
" asyncrun.vim - Run shell commands in background and output to quickfix
"
" Maintainer: skywind3000 (at) gmail.com, 2016-2023
" Maintainer: skywind3000 (at) gmail.com, 2016-2024
" Homepage: https://github.com/skywind3000/asyncrun.vim
"
" Last Modified: 2023/09/25 23:19
" Last Modified: 2024/02/16 11:36
"
" Run shell command in background and output to quickfix:
" :AsyncRun[!] [options] {cmd} ...
Expand Down Expand Up @@ -1083,7 +1083,9 @@ function! asyncrun#fullname(f)
let f = ''
elseif &bt != ''
let is_directory = 0
if f =~ '[\/\\]$'
if f =~ '\v^fugitive\:[\\\/][\\\/][\\\/]'
return asyncrun#fullname(f)
elseif f =~ '[\/\\]$'
if f =~ '^[\/\\]' || f =~ '^.:[\/\\]'
let is_directory = isdirectory(f)
endif
Expand All @@ -1092,6 +1094,13 @@ function! asyncrun#fullname(f)
endif
elseif f =~ '^\~[\/\\]'
let f = expand(f)
elseif f =~ '\v^fugitive\:[\\\/][\\\/][\\\/]'
let path = strpart(f, s:asyncrun_windows? 12 : 11)
let pos = stridx(path, '.git')
if pos >= 0
let path = strpart(path, 0, pos)
endif
let f = fnamemodify(path, ':h')
endif
let f = fnamemodify(f, ':p')
if s:asyncrun_windows
Expand Down Expand Up @@ -1139,12 +1148,6 @@ endfunc
" guess root
function! s:guess_root(filename, markers)
let fullname = asyncrun#fullname(a:filename)
if fullname =~ '^fugitive:/'
if exists('b:git_dir')
return fnamemodify(b:git_dir, ':h')
endif
return '' " skip any fugitive buffers early
endif
let pivot = fullname
if !isdirectory(pivot)
let pivot = fnamemodify(pivot, ':h')
Expand Down Expand Up @@ -2295,7 +2298,7 @@ endfunc
" asyncrun - version
"----------------------------------------------------------------------
function! asyncrun#version()
return '2.12.2'
return '2.12.3'
endfunc


Expand Down

0 comments on commit 99b5025

Please sign in to comment.