From da066426fd1c306c4b2776581eabcab73b066677 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 28 Jul 2018 19:41:00 -0400 Subject: [PATCH] Use in detection autocommands --- plugin/fugitive.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 99d04e8..afa41a8 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -66,6 +66,10 @@ function! FugitiveExtractGitDir(path) abort else let path = fnamemodify(path, ':p:h:s?/$??') endif + let pre = substitute(matchstr(path, '^\a\a\+\ze:'), '^.', '\u&', '') + if len(pre) && exists('*' . pre . 'Real') + let path = s:shellslash({pre}Real(path)) + endif let root = resolve(path) if root !=# path silent! exe haslocaldir() ? 'lcd .' : 'cd .' @@ -179,8 +183,8 @@ endfunction augroup fugitive autocmd! - autocmd BufNewFile,BufReadPost * call FugitiveDetect(expand('%:p')) - autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', @%), ':p')) + autocmd BufNewFile,BufReadPost * call FugitiveDetect(expand(':p')) + autocmd FileType netrw call FugitiveDetect(fnamemodify(get(b:, 'netrw_curdir', expand('')), ':p')) autocmd User NERDTreeInit,NERDTreeNewRoot \ if exists('b:NERDTree.root.path.str') | \ call FugitiveDetect(b:NERDTree.root.path.str()) |