Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use g:startify_custom_header_center for centering the header #465

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions autoload/startify.vim
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,15 @@ function! startify#insane_in_the_membrane(on_vimenter) abort
endif

" Must be global so that it can be read by syntax/startify.vim.
let g:startify_header = exists('g:startify_custom_header')
\ ? s:set_custom_section(g:startify_custom_header)
\ : (exists('*strwidth') ? startify#pad(startify#fortune#cowsay()) : [])
if get(g:, 'startify_custom_header_center', 0)
let g:startify_header = exists('g:startify_custom_header')
\ ? s:set_custom_section(startify#center(g:startify_custom_header))
\ : (exists('*strwidth') ? startify#pad(startify#fortune#cowsay()) : [])
else
let g:startify_header = exists('g:startify_custom_header')
\ ? s:set_custom_section(g:startify_custom_header)
\ : (exists('*strwidth') ? startify#pad(startify#fortune#cowsay()) : [])
endif
if !empty(g:startify_header)
let g:startify_header += [''] " add blank line
endif
Expand Down
9 changes: 9 additions & 0 deletions doc/startify.txt
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,15 @@ If you want numbers to start at 1 instead of 0, you could use this:
NOTE: There is no sanitizing going on, so you should know what you're doing!
Avoid using keys from |startify-mappings|.

------------------------------------------------------------------------------
*g:startify_custom_header_center*
This option allows centering the custom header by setting:
>
let g:startify_custom_header_center = 1
<
It will be undefined until the user sets it, and the custom header will not be
centered unless it is set to be true.

------------------------------------------------------------------------------
*g:startify_custom_header*
>
Expand Down
1 change: 1 addition & 0 deletions plugin/startify.vim
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ augroup startify
autocmd VimLeavePre * nested call s:on_vimleavepre()
autocmd QuickFixCmdPre *vimgrep* let g:startify_locked = 1
autocmd QuickFixCmdPost *vimgrep* let g:startify_locked = 0
autocmd VimResized * if &filetype ==# 'startify' | call startify#insane_in_the_membrane(0) | endif
augroup END

function! s:update_oldfiles(file)
Expand Down