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

Allow autoloading sessions from the session directory #482

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
21 changes: 15 additions & 6 deletions autoload/startify.vim
Original file line number Diff line number Diff line change
Expand Up @@ -948,13 +948,22 @@ endfunction

" Function: s:check_user_options {{{1
function! s:check_user_options(path) abort
let session = a:path . s:sep .'Session.vim'
if get(g:, 'startify_session_autoload')
let session = a:path . s:sep . 'Session.vim'
if filereadable(glob(session))
execute 'silent bwipeout' a:path
call startify#session_delete_buffers()
execute 'source' session
return
endif

if get(g:, 'startify_session_autoload') && filereadable(glob(session))
execute 'silent bwipeout' a:path
call startify#session_delete_buffers()
execute 'source' session
return
let session = startify#get_session_path() . startify#get_separator() . fnamemodify(getcwd(), ':t')
if filereadable(glob(session))
execute 'silent bwipeout' a:path
call startify#session_delete_buffers()
execute 'source' session
return
endif
endif

if get(g:, 'startify_change_to_vcs_root') && s:cd_to_vcs_root(a:path)
Expand Down
3 changes: 3 additions & 0 deletions plugin/startify.vim
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ endfunction

function! s:on_vimenter()
if !argc() && line2byte('$') == -1
let session = startify#get_session_path() . startify#get_separator() . fnamemodify(getcwd(), ':t')
if get(g:, 'startify_session_autoload') && filereadable('Session.vim')
source Session.vim
elseif get(g:, 'startify_session_autoload') && filereadable(session)
execute 'source ' . session
elseif !get(g:, 'startify_disable_at_vimenter')
call startify#insane_in_the_membrane(1)
endif
Expand Down