nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 7d1cc4ececdd2002a83a1653f64d0e9fa9e72e55
parent c008fb3983775f553b06db8f806757677b759113
Author: Martin Grenfell <martin_grenfell@msn.com>
Date:   Thu, 17 Apr 2008 23:39:23 +1200

bugfix: the script failed when being initialized on a dir containing spaces

Diffstat:
Mdoc/NERD_tree.txt | 3+++
Mplugin/NERD_tree.vim | 7++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt
@@ -999,3 +999,6 @@ the &hidden option is set.
 
 Thanks to Olivier Yiptong for prompting me to make line numbers in the
 NERD tree window optional.
+
+Thanks to Zhang Shuhan for a bug report when initializing the tree in a dir
+containing spaces.
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -1312,7 +1312,9 @@ function! s:InitNerdTree(dir)
     let dir = a:dir == '' ? expand('%:p:h') : a:dir
     let dir = resolve(dir)
 
-    if !isdirectory(dir)
+    let path = s:oPath.New(dir)
+
+    if !path.isDirectory
         call s:EchoWarning("Error reading: " . dir)
         return
     endif
@@ -1320,7 +1322,7 @@ function! s:InitNerdTree(dir)
     "if instructed to, then change the vim CWD to the dir the NERDTree is
     "inited in 
     if g:NERDTreeChDirMode != 0
-        exec "cd " . dir
+        exec "cd " . path.StrForOS(1)
     endif
 
     let t:treeShowHelp = 0
@@ -1333,7 +1335,6 @@ function! s:InitNerdTree(dir)
         unlet t:NERDTreeRoot
     endif
 
-    let path = s:oPath.New(dir)
     let t:NERDTreeRoot = s:oTreeDirNode.New(path)
     call t:NERDTreeRoot.Open()