From 82c1fece9fbdb9fcce4e12c892e7a205065608a3 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sun, 8 Jun 2008 18:24:47 +1200 Subject: [PATCH] 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 --- plugin/NERD_tree.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 629b8f1..2bed6fa 100644 --- 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)