From 9a833c5bc686c92f88a76dcb8983a96417c1880e Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Sun, 29 May 2016 11:06:29 +0200 Subject: [PATCH] Add ex command list --- autoload/startify.vim | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/autoload/startify.vim b/autoload/startify.vim index 13e46de..2f5e634 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -113,6 +113,7 @@ function! startify#insane_in_the_membrane() abort \ [' MRU '. getcwd()], 'dir', \ [' Sessions'], 'sessions', \ [' Bookmarks'], 'bookmarks', + \ [' Ex commands'], 'ex_commands', \ ]) for item in s:lists @@ -621,6 +622,33 @@ function! s:show_bookmarks() abort call append('$', '') endfunction +" Function: s:show_ex_commands {{{1 +function! s:show_ex_commands() abort + if !exists('g:startify_ex_commands') || empty(g:startify_ex_commands) + return + endif + + if exists('s:last_message') + call s:print_section_header() + endif + + for ex_command_item in g:startify_ex_commands + if type(ex_command_item) == type({}) + let [index, ex_command_str] = items(ex_command_item)[0] + else " string + let [index, ex_command_str] = [s:get_index_as_string(s:entry_number), ex_command_item] + let s:entry_number += 1 + endif + + call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . ex_command_str) + call s:register(line('$'), index, 'special', ex_command_str, '', s:nowait_string) + + unlet ex_command_item " avoid type mismatch for heterogeneous lists + endfor + + call append('$', '') +endfunction + " Function: s:is_in_skiplist {{{1 function! s:is_in_skiplist(arg) abort for regexp in s:skiplist