nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 5685fa7af47fe182d2e55e112b510cdecb487d0a
parent 990706b72518f7f387afcefc1a1750a23df24cf7
Author: Martin Grenfell <martin_grenfell@msn.com>
Date:   Fri,  6 Jun 2008 23:33:48 +1200

add :OpenMark command

Diffstat:
Mplugin/NERD_tree.vim | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -2431,6 +2431,7 @@ function! s:BindMappings()
 
     command! -buffer -nargs=1 Mark :call <SID>MarkNode('<args>')
     command! -buffer -complete=customlist,s:FindMarks -nargs=1 RecallMark :call <SID>RecallMark('<args>')
+    command! -buffer -complete=customlist,s:FindMarks -nargs=1 OpenMark :call <SID>OpenMark('<args>')
 endfunction
 
 "FUNCTION: s:CheckForActivate() {{{2
@@ -2814,6 +2815,22 @@ function! s:OpenExplorer()
     endif
 endfunction
 
+" FUNCTION: s:OpenMark(name) {{{2
+" put the cursor on the given mark and, if its a file, open it
+function! s:OpenMark(name)
+    try
+        let mark = s:GetMarks()[a:name]
+    catch /E716/ "key not in dictionary error
+        call s:Echo("Invalid mark name")
+        return
+    endtry
+
+    let targetNode = t:NERDTreeRoot.FindNode(mark)
+    call s:PutCursorOnNode(targetNode, 0, 1)
+    if !targetNode.path.isDirectory
+        call s:OpenFileNode(targetNode)
+    endif
+endfunction
 " FUNCTION: s:OpenNodeNewTab(stayCurrentTab) {{{2
 " Opens the currently selected file from the explorer in a
 " new tab