nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit eb048a3070241c8340f9b4bfe62c736ed5023b50
parent bf4591c5d82bdcb47ee55290f13e85da81cd947e
Author: mnussbaum <michaelnussbaum08@gmail.com>
Date:   Tue, 12 Jun 2018 12:43:25 -0700

Bugfix - ensure keymaps dictionary exists before using it

The s:KeyMap._all function isn't necessary if we initialize the
s:keyMaps dictionary at file load time.

Diffstat:
Mlib/nerdtree/key_map.vim | 16++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/lib/nerdtree/key_map.vim b/lib/nerdtree/key_map.vim
@@ -2,19 +2,11 @@
 "============================================================
 let s:KeyMap = {}
 let g:NERDTreeKeyMap = s:KeyMap
-
-"FUNCTION: KeyMap._all() {{{1
-function! s:KeyMap._all()
-    if !exists("s:keyMaps")
-        let s:keyMaps = {}
-    endif
-
-    return s:keyMaps
-endfunction
+let s:keyMaps = {}
 
 "FUNCTION: KeyMap.All() {{{1
 function! s:KeyMap.All()
-    let sortedKeyMaps = values(s:KeyMap._all())
+    let sortedKeyMaps = values(s:keyMaps)
     call sort(sortedKeyMaps, s:KeyMap.Compare, s:KeyMap)
 
     return sortedKeyMaps
@@ -36,12 +28,12 @@ endfunction
 
 "FUNCTION: KeyMap.FindFor(key, scope) {{{1
 function! s:KeyMap.FindFor(key, scope)
-    return get(s:KeyMap._all(), a:key . a:scope, {})
+    return get(s:keyMaps, a:key . a:scope, {})
 endfunction
 
 "FUNCTION: KeyMap.BindAll() {{{1
 function! s:KeyMap.BindAll()
-    for i in values(s:KeyMap._all())
+    for i in values(s:keyMaps)
         call i.bind()
     endfor
 endfunction