nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 57c825a169cfe7b77c247fd0e9eb8812cdbb5f76
parent 0788027b55e2415561bdad880cb7315dc50b7238
Author: Jason Franklin <j_fra@fastmail.us>
Date:   Wed,  6 Jun 2018 09:02:25 -0400

Add code to sort mappings in quickhelp

Diffstat:
Mlib/nerdtree/key_map.vim | 20+++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/lib/nerdtree/key_map.vim b/lib/nerdtree/key_map.vim
@@ -5,12 +5,30 @@ let g:NERDTreeKeyMap = s:KeyMap
 
 "FUNCTION: KeyMap.All() {{{1
 function! s:KeyMap.All()
-    if !exists("s:keyMaps")
+
+    if !exists('s:keyMaps')
         let s:keyMaps = []
     endif
+
+    call sort(s:keyMaps, s:KeyMap.Compare, s:KeyMap)
+
     return s:keyMaps
 endfunction
 
+"FUNCTION: KeyMap.Compare(keyMap1, keyMap2) {{{1
+function! s:KeyMap.Compare(keyMap1, keyMap2)
+
+    if a:keyMap1.key >? a:keyMap2.key
+        return 1
+    endif
+
+    if a:keyMap1.key <? a:keyMap2.key
+        return -1
+    endif
+
+    return 0
+endfunction
+
 "FUNCTION: KeyMap.FindFor(key, scope) {{{1
 function! s:KeyMap.FindFor(key, scope)
     for i in s:KeyMap.All()