nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 40ccf3cd4540c95390ad8b9e0c082cf0af21b59d
parent 1b17f945a3d2776a031b37ac486d6398863adf0b
Author: Martin Grenfell <martin_grenfell@msn.com>
Date:   Mon,  9 Jun 2008 22:04:31 +1200

make the mark manipulation funcs use the caching

s:ClearMarks(), s:ClearAllMarks() and s:MarkNode() now use tell the
relevant path objects to update their mark cache

Diffstat:
Mplugin/NERD_tree.vim | 24+++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -188,6 +188,7 @@ function! s:oTreeFileNode.ClearMarks() dict
             call remove(marks, i)
         end
     endfor
+    call self.path.CacheMarkNames()
 endfunction
 "FUNCTION: oTreeFileNode.Copy(dest) {{{3
 function! s:oTreeFileNode.Copy(dest) dict
@@ -1404,7 +1405,18 @@ endfunction " >>>
 "FUNCTION: s:ClearAllMarks() {{{2
 "delete all marks
 function! s:ClearAllMarks()
-    let g:NERDTreeMarks = {}
+    for name in keys(g:NERDTreeMarks)
+        let node = {}
+        try
+            let node = s:GetNodeForMark(name, 1)
+        catch /NERDTree/
+        endtry
+        call remove(g:NERDTreeMarks, name)
+        if !empty(node)
+            call node.path.CacheMarkNames()
+        endif
+    endfor
+    call s:WriteMarks()
 endfunction
 "FUNCTION: s:GetNodeForMark(name, searchFromAbsoluteRoot) {{{2
 "get the treenode for the mark with the given name
@@ -2609,10 +2621,19 @@ function! s:ClearMarks(marks)
     else
         for name in split(a:marks, ' ')
             if count(keys(marks), name)
+                let node = {}
+                try
+                    let node = s:GetNodeForMark(name, 1)
+                catch /NERDTree/
+                endtry
                 call remove(marks, name)
+                if !empty(node)
+                    call node.path.CacheMarkNames()
+                endif
             endif
         endfor
     endif
+    call s:WriteMarks()
     call s:RenderView()
 endfunction
 " FUNCTION: s:CloseChildren() {{{2
@@ -2893,6 +2914,7 @@ function! s:MarkNode(name)
     if currentNode != {}
         let marks = s:GetMarks()
         let marks[a:name] = currentNode.path
+        call currentNode.path.CacheMarkNames()
         call s:WriteMarks()
         call s:RenderView()
     else