Skip to content

Commit

Permalink
Merge pull request #849 from lifecrisis/sort-maps
Browse files Browse the repository at this point in the history
  • Loading branch information
lifecrisis authored Jun 6, 2018
2 parents 0788027 + 57c825a commit 9af083a
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/nerdtree/key_map.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9af083a

Please sign in to comment.