From f41e5c96797a51d08a8bc36cb8a6fde191a0c000 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 8 Mar 2010 22:51:10 -0500 Subject: [PATCH] Attempt to support 'noshellslash' on Windows --- plugin/fugitive.vim | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 51d18d8..2b38fa1 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -92,10 +92,15 @@ let s:abstract_prototype = {} " Initialization {{{1 function! s:ExtractGitDir(path) abort - if a:path =~? '^fugitive://.*//' - return matchstr(a:path,'fugitive://\zs.\{-\}\ze//') + if exists('+shellslash') && !&shellslash + let path = s:gsub(a:path,'\\','/') + else + let path = a:path endif - let fn = fnamemodify(a:path,':s?[\/]$??') + if path =~? '^fugitive://.*//' + return matchstr(path,'fugitive://\zs.\{-\}\ze//') + endif + let fn = fnamemodify(path,':s?[\/]$??') let ofn = "" let nfn = fn while fn != ofn @@ -367,7 +372,12 @@ endfunction function! s:buffer_name() dict abort let bufname = bufname(self['#']) - return bufname == '' ? '' : fnamemodify(bufname,':p') + let bufname = bufname == '' ? '' : fnamemodify(bufname,':p') + if exists('+shellslash') && !&shellslash + return s:gsub(bufname,'\\','/') + else + return bufname + endif endfunction function! s:buffer_commit() dict abort