Add helper functions startify#pad() and startify#center()

This commit is contained in:
Marco Hinz 2019-10-01 17:19:38 +02:00 committed by Marco Hinz
parent a90684813f
commit aa4f53c9f7
2 changed files with 23 additions and 15 deletions

View file

@ -424,6 +424,18 @@ function! startify#open_buffers(...) abort
endif
endfunction
" Function: #pad {{{1
function! startify#pad(lines) abort
return map(copy(a:lines), 's:padding_left . v:val')
endfunction
" Function: #center {{{1
function! startify#center(lines) abort
let longest_line = max(map(copy(a:lines), 'strwidth(v:val)'))
return map(copy(a:lines),
\ 'repeat(" ", (&columns / 2) - (longest_line / 2) - 1) . v:val')
endfunction
" Function: s:get_lists {{{1
function! s:get_lists() abort
if exists('g:startify_lists')