Support Projectionist config in .git/info/projections.json

This commit is contained in:
Tim Pope
2018-08-26 17:42:19 -04:00
parent bb2797d313
commit a202238b5d

View File

@@ -212,6 +212,18 @@ function! s:Slash(path) abort
endif endif
endfunction endfunction
function! s:ProjectionistDetect() abort
let file = s:Slash(get(g:, 'projectionist_file', ''))
let dir = FugitiveExtractGitDir(file)
let base = matchstr(file, '^fugitive://.\{-\}//\x\+')
if empty(base)
let base = FugitiveTreeForGitDir(dir)
endif
if len(base)
call projectionist#append(base, FugitiveCommonDir(dir) . '/info/projections.json')
endif
endfunction
augroup fugitive augroup fugitive
autocmd! autocmd!
@@ -258,4 +270,6 @@ augroup fugitive
endif endif
autocmd User Flags call Hoist('buffer', function('FugitiveStatusline')) autocmd User Flags call Hoist('buffer', function('FugitiveStatusline'))
autocmd User ProjectionistDetect call s:ProjectionistDetect()
augroup END augroup END