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

Optionally allow Startify variables to be updated #525

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
56 changes: 34 additions & 22 deletions autoload/startify.vim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ function! startify#get_session_path() abort
endfunction

" Function: #insane_in_the_membrane {{{1
function! startify#insane_in_the_membrane(on_vimenter) abort
" optional second parameter is if the user wants to update Startify during
" runtime
function! startify#insane_in_the_membrane(on_vimenter, ...) abort
let update = get(a:, 1, 0)
if update
call s:update_variables()
endif
" Handle vim -y, vim -M.
if a:on_vimenter && (&insertmode || !&modifiable)
return
Expand Down Expand Up @@ -1150,24 +1156,30 @@ function! s:warn(msg) abort
endfunction

" Init: values {{{1
let s:sep = startify#get_separator()

let g:startify_files_number = get(g:, 'startify_files_number', 10)
let g:startify_enable_special = get(g:, 'startify_enable_special', 1)
let g:startify_relative_path = get(g:, 'startify_relative_path') ? ':~:.' : ':p:~'
let s:session_dir = startify#get_session_path()
let g:startify_transformations = get(g:, 'startify_transformations', [])

let g:startify_skiplist = extend(get(g:, 'startify_skiplist', []), [
\ 'runtime/doc/.*\.txt$',
\ 'bundle/.*/doc/.*\.txt$',
\ 'plugged/.*/doc/.*\.txt$',
\ '/.git/',
\ 'fugitiveblame$',
\ escape(fnamemodify(resolve($VIMRUNTIME), ':p'), '\') .'doc/.*\.txt$',
\ ], 'keep')

let g:startify_padding_left = get(g:, 'startify_padding_left', 3)
let s:leftpad = repeat(' ', g:startify_padding_left)
let s:fixed_column = g:startify_padding_left + 2
let s:batchmode = ''
" Allows Startify to be updated during a vim session
" Runs once on source, optionally runs during
" startify#insane_in_the_membrane()
function! s:update_variables()
let s:sep = startify#get_separator()

let g:startify_files_number = get(g:, 'startify_files_number', 10)
let g:startify_enable_special = get(g:, 'startify_enable_special', 1)
let g:startify_relative_path = get(g:, 'startify_relative_path') ? ':~:.' : ':p:~'
let s:session_dir = startify#get_session_path()
let g:startify_transformations = get(g:, 'startify_transformations', [])

let g:startify_skiplist = extend(get(g:, 'startify_skiplist', []), [
\ 'runtime/doc/.*\.txt$',
\ 'bundle/.*/doc/.*\.txt$',
\ 'plugged/.*/doc/.*\.txt$',
\ '/.git/',
\ 'fugitiveblame$',
\ escape(fnamemodify(resolve($VIMRUNTIME), ':p'), '\') .'doc/.*\.txt$',
\ ], 'keep')

let g:startify_padding_left = get(g:, 'startify_padding_left', 3)
let s:leftpad = repeat(' ', g:startify_padding_left)
let s:fixed_column = g:startify_padding_left + 2
let s:batchmode = ''
endfunction
call s:update_variables()