commit 0b0c76626bbb6b674018ac63fe050d039131f618
parent 04aa45fcd8228d7238c3af0b90f2b328add032e2
Author: Dave Aitken <dave.aitken@gmail.com>
Date: Thu, 7 Jul 2011 02:38:01 -0700
Added support for windows network shares (\\box\share format paths)
Diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -1880,7 +1880,7 @@ let s:Path = {}
function! s:Path.AbsolutePathFor(str)
let prependCWD = 0
if s:running_windows
- let prependCWD = a:str !~# '^.:\(\\\|\/\)'
+ let prependCWD = a:str !~# '^.:\(\\\|\/\)' && a:str !~# '^\(\\\\\|\/\/\)'
else
let prependCWD = a:str !~# '^/'
endif
@@ -2109,7 +2109,12 @@ endfunction
"If running windows, cache the drive letter for this path
function! s:Path.extractDriveLetter(fullpath)
if s:running_windows
- let self.drive = substitute(a:fullpath, '\(^[a-zA-Z]:\).*', '\1', '')
+ if a:fullpath =~ '^\(\\\\\|\/\/\)'
+ let self.drive = substitute(a:fullpath, '^\(\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\).*', '\1', '')
+ let self.drive = substitute(self.drive, '/', '\', "g")
+ else
+ let self.drive = substitute(a:fullpath, '\(^[a-zA-Z]:\).*', '\1', '')
+ endif
else
let self.drive = ''
endif
@@ -2489,6 +2494,9 @@ function! s:Path.WinToUnixPath(pathstr)
"remove the x:\ of the front
let toReturn = substitute(toReturn, '^.*:\(\\\|/\)\?', '/', "")
+ "remove the \\ network share from the front
+ let toReturn = substitute(toReturn, '^\(\\\\\|\/\/\)[^\\\/]*\(\\\|\/\)[^\\\/]*\(\\\|\/\)\?', '/', "")
+
"convert all \ chars to /
let toReturn = substitute(toReturn, '\', '/', "g")
@@ -4114,4 +4122,4 @@ endfunction
"reset &cpo back to users setting
let &cpo = s:old_cpo
-" vim: set sw=4 sts=4 et fdm=marker:
+" vim: set sw=4 sts=4 et fdm=marker:
+\ No newline at end of file