From a202238b5d5070d429260c47559585718de69930 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 26 Aug 2018 17:42:19 -0400 Subject: [PATCH] Support Projectionist config in .git/info/projections.json --- plugin/fugitive.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index c33e368..8b667dd 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -212,6 +212,18 @@ function! s:Slash(path) abort endif 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 autocmd! @@ -258,4 +270,6 @@ augroup fugitive endif autocmd User Flags call Hoist('buffer', function('FugitiveStatusline')) + + autocmd User ProjectionistDetect call s:ProjectionistDetect() augroup END