Allow custom indices per list

Implements #338
This commit is contained in:
Marco Hinz 2018-10-30 21:23:47 +01:00 committed by Marco Hinz
parent 556bf1d507
commit 0bc6e863d6
2 changed files with 12 additions and 3 deletions

View file

@ -91,7 +91,7 @@ function! startify#insane_in_the_membrane() abort
endif
call append('$', g:startify_header)
let b:startify = { 'tick': 0, 'entries': {} }
let b:startify = { 'tick': 0, 'entries': {}, 'indices': [] }
if s:show_special
call append('$', [s:padding_left .'[e] <empty buffer>', ''])
@ -454,6 +454,8 @@ function! s:show_lists(lists) abort
continue
endif
let b:startify.indices = copy(get(list, 'indices', []))
if type(list.type) == type('')
if has_key(list, 'header')
let s:last_message = list.header
@ -924,7 +926,9 @@ endfunction
" Function: s:get_index_as_string {{{1
function! s:get_index_as_string(idx) abort
if exists('g:startify_custom_indices')
if !empty(b:startify.indices)
return remove(b:startify.indices, 0)
elseif exists('g:startify_custom_indices')
let listlen = len(g:startify_custom_indices)
return (a:idx < listlen) ? g:startify_custom_indices[a:idx] : string(a:idx - listlen)
else