commit 665f326577e319f4fd1321ee664365b0a81b8d37
parent a0de028688b4802de65c1b17963d7e5479035530
Author: Martin Grenfell <martin.grenfell@gmail.com>
Date: Fri, 20 Nov 2015 01:44:12 +0000
remove dependency on b:NERDTree from classes that dont need it
Inject it where needed.
Diffstat:
9 files changed, 86 insertions(+), 83 deletions(-)
diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim
@@ -105,7 +105,7 @@ endfunction
"FUNCTION: s:activateBookmark() {{{1
"handle the user activating a bookmark
function! s:activateBookmark(bm)
- call a:bm.activate(!a:bm.path.isDirectory ? {'where': 'p'} : {})
+ call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {})
endfunction
" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
@@ -155,7 +155,7 @@ function! nerdtree#ui_glue#chRootCwd()
if cwd.str() == g:NERDTreeFileNode.GetRootForTab().path.str()
return
endif
- call s:chRoot(g:NERDTreeDirNode.New(cwd))
+ call s:chRoot(g:NERDTreeDirNode.New(cwd, b:NERDTree))
endfunction
" FUNCTION: nnerdtree#ui_glue#clearBookmarks(bookmarks) {{{1
@@ -171,6 +171,7 @@ function! nerdtree#ui_glue#clearBookmarks(bookmarks)
call bookmark.delete()
endfor
endif
+ call b:NERDTree.root.refresh()
call b:NERDTree.render()
endfunction
@@ -225,6 +226,7 @@ function! s:deleteBookmark(bm)
if nr2char(getchar()) ==# 'y'
try
call a:bm.delete()
+ call b:NERDTree.root.refresh()
call b:NERDTree.render()
redraw
catch /^NERDTree/
@@ -279,7 +281,7 @@ function! s:findAndRevealPath()
call g:NERDTree.CursorToTreeWin()
endif
call b:NERDTree.setShowHidden(g:NERDTreeShowHidden)
- call s:chRoot(g:NERDTreeDirNode.New(p.getParent()))
+ call s:chRoot(g:NERDTreeDirNode.New(p.getParent(), b:NERDTree))
else
if !g:NERDTree.IsOpen()
call g:NERDTreeCreator.ToggleTabTree("")
@@ -442,13 +444,13 @@ endfunction
" put the cursor on the given bookmark and, if its a file, open it
function! nerdtree#ui_glue#openBookmark(name)
try
- let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0)
+ let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
call targetNode.putCursorHere(0, 1)
redraw!
catch /^NERDTree.BookmarkedNodeNotFoundError/
call nerdtree#echo("note - target node is not cached")
let bookmark = g:NERDTreeBookmark.BookmarkFor(a:name)
- let targetNode = g:NERDTreeFileNode.New(bookmark.path)
+ let targetNode = g:NERDTreeFileNode.New(bookmark.path, b:NERDTree)
endtry
if targetNode.path.isDirectory
call targetNode.openExplorer()
@@ -510,7 +512,7 @@ endfunction
" put the cursor on the node associate with the given name
function! nerdtree#ui_glue#revealBookmark(name)
try
- let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0)
+ let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
call targetNode.putCursorHere(0, 1)
catch /^NERDTree.BookmarkNotFoundError/
call nerdtree#echo("Bookmark isnt cached under the current root")
@@ -614,7 +616,7 @@ function! nerdtree#ui_glue#upDir(keepState)
if empty(b:NERDTree.root.parent)
let path = b:NERDTree.root.path.getParent()
- let newRoot = g:NERDTreeDirNode.New(path)
+ let newRoot = g:NERDTreeDirNode.New(path, b:NERDTree)
call newRoot.open()
call newRoot.transplantChild(b:NERDTree.root)
let b:NERDTree.root = newRoot
diff --git a/lib/nerdtree/bookmark.vim b/lib/nerdtree/bookmark.vim
@@ -3,9 +3,9 @@
let s:Bookmark = {}
let g:NERDTreeBookmark = s:Bookmark
-" FUNCTION: Bookmark.activate() {{{1
-function! s:Bookmark.activate(...)
- call self.open(a:0 ? a:1 : {})
+" FUNCTION: Bookmark.activate(nerdtree) {{{1
+function! s:Bookmark.activate(nerdtree, ...)
+ call self.open(a:nerdtree, a:0 ? a:1 : {})
endfunction
" FUNCTION: Bookmark.AddBookmark(name, path) {{{1
@@ -128,26 +128,18 @@ endfunction
" Delete this bookmark. If the node for this bookmark is under the current
" root, then recache bookmarks for its Path object
function! s:Bookmark.delete()
- let node = {}
- try
- let node = self.getNode(1)
- catch /^NERDTree.BookmarkedNodeNotFoundError/
- endtry
call remove(s:Bookmark.Bookmarks(), index(s:Bookmark.Bookmarks(), self))
- if !empty(node)
- call node.path.cacheDisplayString()
- endif
call s:Bookmark.Write()
endfunction
-" FUNCTION: Bookmark.getNode(searchFromAbsoluteRoot) {{{1
+" FUNCTION: Bookmark.getNode(nerdtree, searchFromAbsoluteRoot) {{{1
" Gets the treenode for this bookmark
"
" Args:
" searchFromAbsoluteRoot: specifies whether we should search from the current
" tree root, or the highest cached node
-function! s:Bookmark.getNode(searchFromAbsoluteRoot)
- let searchRoot = a:searchFromAbsoluteRoot ? g:NERDTreeDirNode.AbsoluteTreeRoot() : b:NERDTree.root
+function! s:Bookmark.getNode(nerdtree, searchFromAbsoluteRoot)
+ let searchRoot = a:searchFromAbsoluteRoot ? a:nerdtree.root.AbsoluteTreeRoot() : a:nerdtree.root
let targetNode = searchRoot.findNode(self.path)
if empty(targetNode)
throw "NERDTree.BookmarkedNodeNotFoundError: no node was found for bookmark: " . self.name
@@ -155,12 +147,12 @@ function! s:Bookmark.getNode(searchFromAbsoluteRoot)
return targetNode
endfunction
-" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) {{{1
+" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree) {{{1
" Class method that finds the bookmark with the given name and returns the
" treenode for it.
-function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot)
+function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot, nerdtree)
let bookmark = s:Bookmark.BookmarkFor(a:name)
- return bookmark.getNode(a:searchFromAbsoluteRoot)
+ return bookmark.getNode(nerdtree, a:searchFromAbsoluteRoot)
endfunction
" FUNCTION: Bookmark.GetSelected() {{{1
@@ -210,8 +202,11 @@ function! s:Bookmark.New(name, path)
return newBookmark
endfunction
-" FUNCTION: Bookmark.open([options]) {{{1
+" FUNCTION: Bookmark.open(nerdtree, [options]) {{{1
"Args:
+"
+"nerdtree: the tree to load open the bookmark in
+"
"A dictionary containing the following keys (all optional):
" 'where': Specifies whether the node should be opened in new split/tab or in
" the previous window. Can be either 'v' (vertical split), 'h'
@@ -220,11 +215,11 @@ endfunction
" 'keepopen': dont close the tree window
" 'stay': open the file, but keep the cursor in the tree win
"
-function! s:Bookmark.open(...)
+function! s:Bookmark.open(nerdtree, ...)
let opts = a:0 ? a:1 : {}
if self.path.isDirectory && !has_key(opts, 'where')
- call self.toRoot()
+ call self.toRoot(a:nerdtree)
else
let opener = g:NERDTreeOpener.New(self.path, opts)
call opener.open(self)
@@ -266,24 +261,24 @@ function! s:Bookmark.str()
return '>' . self.name . ' ' . pathStr
endfunction
-" FUNCTION: Bookmark.toRoot() {{{1
+" FUNCTION: Bookmark.toRoot(nerdtree) {{{1
" Make the node for this bookmark the new tree root
-function! s:Bookmark.toRoot()
+function! s:Bookmark.toRoot(nerdtree)
if self.validate()
try
- let targetNode = self.getNode(1)
+ let targetNode = self.getNode(a:nerdtree, 1)
catch /^NERDTree.BookmarkedNodeNotFoundError/
- let targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path)
+ let targetNode = g:NERDTreeFileNode.New(s:Bookmark.BookmarkFor(self.name).path, a:nerdtree)
endtry
- call b:NERDTree.changeRoot(targetNode)
+ call a:nerdtree.changeRoot(targetNode)
endif
endfunction
-" FUNCTION: Bookmark.ToRoot(name) {{{1
+" FUNCTION: Bookmark.ToRoot(name, nerdtree) {{{1
" Make the node for this bookmark the new tree root
-function! s:Bookmark.ToRoot(name)
+function! s:Bookmark.ToRoot(name, nerdtree)
let bookmark = s:Bookmark.BookmarkFor(a:name)
- call bookmark.toRoot()
+ call bookmark.toRoot(a:nerdtree)
endfunction
" FUNCTION: Bookmark.validate() {{{1
@@ -292,7 +287,6 @@ function! s:Bookmark.validate()
return 1
else
call s:Bookmark.CacheBookmarks(1)
- call b:NERDTree.render()
call nerdtree#echo(self.name . "now points to an invalid location. See :help NERDTreeInvalidBookmarks for info.")
return 0
endif
diff --git a/lib/nerdtree/creator.vim b/lib/nerdtree/creator.vim
@@ -16,7 +16,7 @@ function! s:Creator._bindMappings()
command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 RevealBookmark :call nerdtree#ui_glue#revealBookmark('<args>')
command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark :call nerdtree#ui_glue#openBookmark('<args>')
command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=* ClearBookmarks call nerdtree#ui_glue#clearBookmarks('<args>')
- command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=+ BookmarkToRoot call g:NERDTreeBookmark.ToRoot('<args>')
+ command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=+ BookmarkToRoot call g:NERDTreeBookmark.ToRoot('<args>', b:NERDTree)
command! -buffer -nargs=0 ClearAllBookmarks call g:NERDTreeBookmark.ClearAll() <bar> call b:NERDTree.render()
command! -buffer -nargs=0 ReadBookmarks call g:NERDTreeBookmark.CacheBookmarks(0) <bar> call b:NERDTree.render()
command! -buffer -nargs=0 WriteBookmarks call g:NERDTreeBookmark.Write()
diff --git a/lib/nerdtree/nerdtree.vim b/lib/nerdtree/nerdtree.vim
@@ -148,7 +148,7 @@ endfunction
function! s:NERDTree.New(path, type)
let newObj = copy(self)
let newObj.ui = g:NERDTreeUI.New(newObj)
- let newObj.root = g:NERDTreeDirNode.New(a:path)
+ let newObj.root = g:NERDTreeDirNode.New(a:path, newObj)
let newObj._type = a:type
return newObj
endfunction
diff --git a/lib/nerdtree/notifier.vim b/lib/nerdtree/notifier.vim
@@ -11,8 +11,8 @@ function! s:Notifier.AddListener(event, funcname)
call add(listeners, a:funcname)
endfunction
-function! s:Notifier.NotifyListeners(event, path, params)
- let event = g:NERDTreeEvent.New(b:NERDTree, a:path, a:event, a:params)
+function! s:Notifier.NotifyListeners(event, path, nerdtree, params)
+ let event = g:NERDTreeEvent.New(a:nerdtree, a:path, a:event, a:params)
for listener in s:Notifier.GetListenersForEvent(a:event)
call {listener}(event)
diff --git a/lib/nerdtree/path.vim b/lib/nerdtree/path.vim
@@ -406,11 +406,11 @@ function! s:Path.isUnixHiddenPath()
endif
endfunction
-"FUNCTION: Path.ignore() {{{1
+"FUNCTION: Path.ignore(nerdtree) {{{1
"returns true if this path should be ignored
-function! s:Path.ignore()
+function! s:Path.ignore(nerdtree)
"filter out the user specified paths to ignore
- if b:NERDTree.ui.isIgnoreFilterEnabled()
+ if a:nerdtree.ui.isIgnoreFilterEnabled()
for i in g:NERDTreeIgnore
if self._ignorePatternMatches(i)
return 1
@@ -418,18 +418,18 @@ function! s:Path.ignore()
endfor
for callback in g:NERDTree.PathFilters()
- if {callback}({'path': self, 'nerdtree': b:NERDTree})
+ if {callback}({'path': self, 'nerdtree': a:nerdtree})
return 1
endif
endfor
endif
"dont show hidden files unless instructed to
- if !b:NERDTree.ui.getShowHidden() && self.isUnixHiddenFile()
+ if !a:nerdtree.ui.getShowHidden() && self.isUnixHiddenFile()
return 1
endif
- if b:NERDTree.ui.getShowFiles() ==# 0 && self.isDirectory ==# 0
+ if a:nerdtree.ui.getShowFiles() ==# 0 && self.isDirectory ==# 0
return 1
endif
@@ -572,16 +572,16 @@ function! s:Path.readInfoFromDisk(fullpath)
endif
endfunction
-"FUNCTION: Path.refresh() {{{1
-function! s:Path.refresh()
+"FUNCTION: Path.refresh(nerdtree) {{{1
+function! s:Path.refresh(nerdtree)
call self.readInfoFromDisk(self.str())
- call g:NERDTreePathNotifier.NotifyListeners('refresh', self, {})
+ call g:NERDTreePathNotifier.NotifyListeners('refresh', self, a:nerdtree, {})
call self.cacheDisplayString()
endfunction
-"FUNCTION: Path.refreshFlags() {{{1
-function! s:Path.refreshFlags()
- call g:NERDTreePathNotifier.NotifyListeners('refreshFlags', self, {})
+"FUNCTION: Path.refreshFlags(nerdtree) {{{1
+function! s:Path.refreshFlags(nerdtree)
+ call g:NERDTreePathNotifier.NotifyListeners('refreshFlags', self, a:nerdtree, {})
call self.cacheDisplayString()
endfunction
diff --git a/lib/nerdtree/tree_dir_node.vim b/lib/nerdtree/tree_dir_node.vim
@@ -21,7 +21,7 @@ unlet s:TreeDirNode.activate
function! s:TreeDirNode.activate(...)
let opts = a:0 ? a:1 : {}
call self.toggleOpen(opts)
- call b:NERDTree.render()
+ call self.getNerdtree().render()
call self.putCursorHere(0, 0)
endfunction
@@ -68,7 +68,7 @@ endfunction
"Returns:
"the newly created node
function! s:TreeDirNode.createChild(path, inOrder)
- let newTreeNode = g:NERDTreeFileNode.New(a:path)
+ let newTreeNode = g:NERDTreeFileNode.New(a:path, self.getNerdtree())
call self.addChild(newTreeNode, a:inOrder)
return newTreeNode
endfunction
@@ -205,7 +205,7 @@ endfunction
function! s:TreeDirNode.getVisibleChildren()
let toReturn = []
for i in self.children
- if i.path.ignore() ==# 0
+ if i.path.ignore(self.getNerdtree()) ==# 0
call add(toReturn, i)
endif
endfor
@@ -258,7 +258,7 @@ function! s:TreeDirNode._initChildren(silent)
try
let path = g:NERDTreePath.New(i)
call self.createChild(path, 0)
- call g:NERDTreePathNotifier.NotifyListeners('init', path, {})
+ call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
let invalidFilesFound += 1
endtry
@@ -277,13 +277,13 @@ function! s:TreeDirNode._initChildren(silent)
return self.getChildCount()
endfunction
-"FUNCTION: TreeDirNode.New(path) {{{1
+"FUNCTION: TreeDirNode.New(path, nerdtree) {{{1
"Returns a new TreeNode object with the given path and parent
"
"Args:
-"path: a path object representing the full filesystem path to the file/dir that the node represents
-unlet s:TreeDirNode.New
-function! s:TreeDirNode.New(path)
+"path: dir that the node represents
+"nerdtree: the tree the node belongs to
+function! s:TreeDirNode.New(path, nerdtree)
if a:path.isDirectory != 1
throw "NERDTree.InvalidArgumentsError: A TreeDirNode object must be instantiated with a directory Path object."
endif
@@ -295,6 +295,7 @@ function! s:TreeDirNode.New(path)
let newTreeNode.children = []
let newTreeNode.parent = {}
+ let newTreeNode._nerdtree = a:nerdtree
return newTreeNode
endfunction
@@ -379,7 +380,7 @@ endfunction
"Args:
"forceOpen: 1 if this node should be opened regardless of file filters
function! s:TreeDirNode._openRecursively2(forceOpen)
- if self.path.ignore() ==# 0 || a:forceOpen
+ if self.path.ignore(self.getNerdtree()) ==# 0 || a:forceOpen
let self.isOpen = 1
if self.children ==# []
call self._initChildren(1)
@@ -396,7 +397,7 @@ endfunction
"FUNCTION: TreeDirNode.refresh() {{{1
unlet s:TreeDirNode.refresh
function! s:TreeDirNode.refresh()
- call self.path.refresh()
+ call self.path.refresh(self.getNerdtree())
"if this node was ever opened, refresh its children
if self.isOpen || !empty(self.children)
@@ -427,7 +428,7 @@ function! s:TreeDirNode.refresh()
"the node doesnt exist so create it
else
- let newNode = g:NERDTreeFileNode.New(path)
+ let newNode = g:NERDTreeFileNode.New(path, self.getNerdtree())
let newNode.parent = self
call add(newChildNodes, newNode)
endif
@@ -452,7 +453,7 @@ endfunction
"FUNCTION: TreeDirNode.refreshFlags() {{{1
unlet s:TreeDirNode.refreshFlags
function! s:TreeDirNode.refreshFlags()
- call self.path.refreshFlags()
+ call self.path.refreshFlags(self.getNerdtree())
for i in self.children
call i.refreshFlags()
endfor
@@ -460,7 +461,7 @@ endfunction
"FUNCTION: TreeDirNode.refreshDirFlags() {{{1
function! s:TreeDirNode.refreshDirFlags()
- call self.path.refreshFlags()
+ call self.path.refreshFlags(self.getNerdtree())
endfunction
"FUNCTION: TreeDirNode.reveal(path) {{{1
diff --git a/lib/nerdtree/tree_file_node.vim b/lib/nerdtree/tree_file_node.vim
@@ -19,7 +19,7 @@ function! s:TreeFileNode.bookmark(name)
"it so we can update its display string
let oldMarkedNode = {}
try
- let oldMarkedNode = g:NERDTreeBookmark.GetNodeForName(a:name, 1)
+ let oldMarkedNode = g:NERDTreeBookmark.GetNodeForName(a:name, 1, self.getNerdtree())
catch /^NERDTree.BookmarkNotFoundError/
catch /^NERDTree.BookmarkedNodeNotFoundError/
endtry
@@ -41,7 +41,7 @@ function! s:TreeFileNode.cacheParent()
if parentPath.equals(self.path)
throw "NERDTree.CannotCacheParentError: already at root"
endif
- let self.parent = s:TreeFileNode.New(parentPath)
+ let self.parent = s:TreeFileNode.New(parentPath, self.getNerdtree())
endif
endfunction
@@ -59,7 +59,7 @@ endfunction
function! s:TreeFileNode.copy(dest)
call self.path.copy(a:dest)
let newPath = g:NERDTreePath.New(a:dest)
- let parent = b:NERDTree.root.findNode(newPath.getParent())
+ let parent = self.getNerdtree().root.findNode(newPath.getParent())
if !empty(parent)
call parent.refresh()
return parent.findNode(newPath)
@@ -165,7 +165,7 @@ function! s:TreeFileNode.findSibling(direction)
"if the next node is not an ignored node (i.e. wont show up in the
"view) then return it
- if self.parent.children[siblingIndx].path.ignore() ==# 0
+ if self.parent.children[siblingIndx].path.ignore(self.getNerdtree()) ==# 0
return self.parent.children[siblingIndx]
endif
@@ -178,6 +178,11 @@ function! s:TreeFileNode.findSibling(direction)
return {}
endfunction
+"FUNCTION: TreeFileNode.getNerdtree(){{{1
+function! s:TreeFileNode.getNerdtree()
+ return self._nerdtree
+endfunction
+
"FUNCTION: TreeFileNode.GetRootForTab(){{{1
"get the root node for this tab
function! s:TreeFileNode.GetRootForTab()
@@ -205,31 +210,32 @@ endfunction
"returns 1 if this node should be visible according to the tree filters and
"hidden file filters (and their on/off status)
function! s:TreeFileNode.isVisible()
- return !self.path.ignore()
+ return !self.path.ignore(self.getNerdtree())
endfunction
"FUNCTION: TreeFileNode.isRoot() {{{1
-"returns 1 if this node is b:NERDTree.root
function! s:TreeFileNode.isRoot()
if !g:NERDTree.ExistsForBuf()
throw "NERDTree.NoTreeError: No tree exists for the current buffer"
endif
- return self.equals(b:NERDTree.root)
+ return self.equals(self.getNerdtree().root)
endfunction
-"FUNCTION: TreeFileNode.New(path) {{{1
+"FUNCTION: TreeFileNode.New(path, nerdtree) {{{1
"Returns a new TreeNode object with the given path and parent
"
"Args:
-"path: a path object representing the full filesystem path to the file/dir that the node represents
-function! s:TreeFileNode.New(path)
+"path: file/dir that the node represents
+"nerdtree: the tree the node belongs to
+function! s:TreeFileNode.New(path, nerdtree)
if a:path.isDirectory
- return g:NERDTreeDirNode.New(a:path)
+ return g:NERDTreeDirNode.New(a:path, a:nerdtree)
else
let newTreeNode = copy(self)
let newTreeNode.path = a:path
let newTreeNode.parent = {}
+ let newTreeNode._nerdtree = a:nerdtree
return newTreeNode
endif
endfunction
@@ -269,7 +275,7 @@ endfunction
"recurseUpward: try to put the cursor on the parent if the this node isnt
"visible
function! s:TreeFileNode.putCursorHere(isJump, recurseUpward)
- let ln = b:NERDTree.ui.getLineNum(self)
+ let ln = self.getNerdtree().ui.getLineNum(self)
if ln != -1
if a:isJump
mark '
@@ -278,11 +284,11 @@ function! s:TreeFileNode.putCursorHere(isJump, recurseUpward)
else
if a:recurseUpward
let node = self
- while node != {} && b:NERDTree.ui.getLineNum(node) ==# -1
+ while node != {} && self.getNerdtree().ui.getLineNum(node) ==# -1
let node = node.parent
call node.open()
endwhile
- call b:NERDTree.render()
+ call self.getNerdtree().render()
call node.putCursorHere(a:isJump, 0)
endif
endif
@@ -290,12 +296,12 @@ endfunction
"FUNCTION: TreeFileNode.refresh() {{{1
function! s:TreeFileNode.refresh()
- call self.path.refresh()
+ call self.path.refresh(self.getNerdtree())
endfunction
"FUNCTION: TreeFileNode.refreshFlags() {{{1
function! s:TreeFileNode.refreshFlags()
- call self.path.refreshFlags()
+ call self.path.refreshFlags(self.getNerdtree())
endfunction
"FUNCTION: TreeFileNode.rename() {{{1
@@ -306,7 +312,7 @@ function! s:TreeFileNode.rename(newName)
call self.parent.removeChild(self)
let parentPath = self.path.getParent()
- let newParent = b:NERDTree.root.findNode(parentPath)
+ let newParent = self.getNerdtree().root.findNode(parentPath)
if newParent != {}
call newParent.createChild(self.path, 1)
diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim
@@ -107,7 +107,7 @@ function! NERDTreeAddNode()
let newPath = g:NERDTreePath.Create(newNodeName)
let parentNode = b:NERDTree.root.findNode(newPath.getParent())
- let newTreeNode = g:NERDTreeFileNode.New(newPath)
+ let newTreeNode = g:NERDTreeFileNode.New(newPath, b:NERDTree)
if empty(parentNode)
call b:NERDTree.root.refresh()
call b:NERDTree.render()