nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit c726ec7318f1cbb756744333c05445d751804e80
parent 18071f599955f6720170d9daa6835a663a6bbaf0
Author: Phil Runninger (mac) <prunninger@vhtcx.com>
Date:   Mon, 10 Sep 2018 06:57:39 -0400

Implement PR review comments.

Diffstat:
Mdoc/NERDTree.txt | 4++--
Mplugin/NERD_tree.vim | 11+++++++----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/doc/NERDTree.txt b/doc/NERDTree.txt
@@ -142,8 +142,8 @@ The following features and functionality are provided by the NERD tree:
     current tab does not exist, a new one will be initialized.
 
 :NERDTreeCWD                                                    *:NERDTreeCWD*
-    Change tree root to current directory. If no NERD tree exists for this
-    tab, a new tree will be opened.
+    Change the NERDTree root to the current working directory. If no NERDTree
+    exists for this tab, a new one is opened.
 
 ------------------------------------------------------------------------------
 2.2. Bookmarks                                             *NERDTreeBookmarks*
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -202,12 +202,15 @@ function! NERDTreeFocus()
 endfunction
 
 function! NERDTreeCWD()
-    let l:cwd = getcwd()
+    let l:cwdPath = g:NERDTreePath.New(getcwd())
     call NERDTreeFocus()
-    if l:cwd != getcwd()
-        exec 'cd '.l:cwd
+
+    if b:NERDTree.root.path.equals(l:cwdPath)
+        return
     endif
-    call nerdtree#ui_glue#chRootCwd()
+
+    let l:newRoot = g:NERDTreeFileNode.New(l:cwdPath, b:NERDTree)
+    call b:NERDTree.changeRoot(l:newRoot)
 endfunction
 
 function! NERDTreeAddPathFilter(callback)