commit 82c1fece9fbdb9fcce4e12c892e7a205065608a3
parent 371379a86000de263db3f09b644a25bf63d713fb
Author: Martin Grenfell <martin_grenfell@msn.com>
Date: Sun, 8 Jun 2008 18:24:47 +1200
make MarkToRoot() work for nodes that arent cached
now if you go :MarkToRoot foo and foo points to a path that isnt
cached, a new tree node will be created and made root. Note that all
cached nodes will be lost as this is the same as opening a new nerd tree
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -2864,7 +2864,12 @@ endfunction
" FUNCTION: s:MarkToRoot(name) {{{2
" Make the node for the given mark the new tree root
function! s:MarkToRoot(name)
- let targetNode = s:GetNodeForMark(a:name, 1)
+ try
+ let targetNode = s:GetNodeForMark(a:name, 1)
+ catch /NERDTree.MarkNotFound/
+ let marks = s:GetMarks()
+ let targetNode = s:oTreeFileNode.New(marks[a:name])
+ endtry
call targetNode.MakeRoot()
call s:RenderView()
call s:PutCursorOnNode(targetNode, 0, 0)