From 888934a3beb5ef69d90664c74eea0d96bfbfd087 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sun, 14 Dec 2008 00:40:17 +1300 Subject: [PATCH] make TreeFileNode#isRoot() assume a tree exists for current buf, not tab --- plugin/NERD_tree.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index b366d71..ecc7a21 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -593,9 +593,10 @@ endfunction "FUNCTION: TreeFileNode.isRoot() {{{3 "returns 1 if this node is b:NERDTreeRoot function! s:TreeFileNode.isRoot() - if !s:treeExistsForTab() - throw "NERDTree.TreeFileNode.IsRoot exception: No tree exists for the current tab" + if !s:treeExistsForBuf() + throw "NERDTree.NoTreeError: No tree exists for the current buffer" endif + return self.equals(b:NERDTreeRoot) endfunction @@ -1794,6 +1795,11 @@ function! s:initNerdTreeInPlace(dir) call s:renderView() endfunction +" Function: s:treeExistsForBuffer() {{{2 +" Returns 1 if a nerd tree root exists in the current buffer +function! s:treeExistsForBuf() + return exists("b:NERDTreeRoot") +endfunction " Function: s:treeExistsForTab() {{{2 " Returns 1 if a nerd tree root exists in the current tab function! s:treeExistsForTab()