commit c63e183acfe581972861c99cec8ee17e8483272e
parent 6334e991929c143db3d6abfe23a345cacfc9ff1a
Author: Martin Grenfell <martin_grenfell@msn.com>
Date: Sun, 8 Jun 2008 21:07:13 +1200
make OpenMark open the mark even if its not cached
if OpenMark is called for a mark for a file that isnt cached in the
tree, just open the file anyway and dont put attempt to put the
cursor on it etc
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -2921,9 +2921,15 @@ endfunction
" FUNCTION: s:OpenMark(name) {{{2
" put the cursor on the given mark and, if its a file, open it
function! s:OpenMark(name)
- let targetNode = s:GetNodeForMark(a:name, 0)
- call s:PutCursorOnNode(targetNode, 0, 1)
- redraw!
+ try
+ let targetNode = s:GetNodeForMark(a:name, 0)
+ call s:PutCursorOnNode(targetNode, 0, 1)
+ redraw!
+ catch /NERDTree.MarkNotFound/
+ call s:Echo("note - target node is not cached")
+ let marks = s:GetMarks()
+ let targetNode = s:oTreeFileNode.New(marks[a:name])
+ endtry
if !targetNode.path.isDirectory
call s:OpenFileNode(targetNode)
endif