From 4337022524ff8cfc8918e4c0b3e0f5c192136792 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Thu, 5 Jan 2012 08:24:15 +0000 Subject: [PATCH] dont convert windows paths to lower case when :editing This fixes #89. --- plugin/NERD_tree.vim | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index a4f8611..92a5a5e 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -2522,20 +2522,18 @@ endfunction "Return: the string for this path that is suitable to be used with the :edit "command function! s:Path._strForEdit() - let p = self.str({'format': 'UI'}) - let cwd = getcwd() - - if s:running_windows - let p = tolower(self.str()) - let cwd = tolower(getcwd()) - endif - - let p = escape(p, s:escape_chars) - - let cwd = cwd . s:Path.Slash() + let p = escape(self.str({'format': 'UI'}), s:escape_chars) + let cwd = getcwd() . s:Path.Slash() "return a relative path if we can - if stridx(p, cwd) ==# 0 + let isRelative = 0 + if s:running_windows + let isRelative = stridx(tolower(p), tolower(cwd)) == 0 + else + let isRelative = stridx(p, cwd) == 0 + endif + + if isRelative let p = strpart(p, strlen(cwd)) "handle the edge case where the file begins with a + (vim interprets @@ -2550,7 +2548,6 @@ function! s:Path._strForEdit() endif return p - endfunction "FUNCTION: Path._strForGlob() {{{3 function! s:Path._strForGlob()