diff --git a/autoload/startify.vim b/autoload/startify.vim index d949596..1d31845 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -164,7 +164,7 @@ function! startify#insane_in_the_membrane(on_vimenter) abort endfunction " Function: #session_load {{{1 -function! startify#session_load(...) abort +function! startify#session_load(source_last_session, ...) abort if !isdirectory(s:session_dir) echomsg 'The session directory does not exist: '. s:session_dir return @@ -177,17 +177,15 @@ function! startify#session_load(...) abort if a:0 let spath .= a:1 + elseif a:source_last_session && !has('win32') + let spath .= '__LAST__' else - if has('win32') - call inputsave() - let spath .= input( - \ 'Load this session: ', - \ fnamemodify(v:this_session, ':t'), - \ 'custom,startify#session_list_as_string') | redraw - call inputrestore() - else - let spath .= '__LAST__' - endif + call inputsave() + let spath .= input( + \ 'Load this session: ', + \ fnamemodify(v:this_session, ':t'), + \ 'custom,startify#session_list_as_string') | redraw + call inputrestore() endif if filereadable(spath) diff --git a/doc/startify.txt b/doc/startify.txt index 3bfaba8..0e08dec 100644 --- a/doc/startify.txt +++ b/doc/startify.txt @@ -742,10 +742,12 @@ Use `:SSave!` or `:SDelete!` to always overwrite or delete an existing session. *startify-:SLoad* > - :SLoad [session] + :SLoad[!] [session] < -Load a session. If you don't specify a session name, it will either prompt you -for one (Windows) or load the last used session (Unix). +Load a session. If you don't specify a session name, it will prompt you for +one. + +If the `!` is given, it tries to source the last used session (only Unix). Providing only a part of the session name works too, if you complete the argument with either or afterwards. diff --git a/plugin/startify.vim b/plugin/startify.vim index db54fa5..c8d8d30 100644 --- a/plugin/startify.vim +++ b/plugin/startify.vim @@ -56,7 +56,7 @@ function! s:on_vimleavepre() endif endfunction -command! -nargs=? -bar -complete=customlist,startify#session_list SLoad call startify#session_load() +command! -nargs=? -bar -bang -complete=customlist,startify#session_list SLoad call startify#session_load(0, ) command! -nargs=? -bar -bang -complete=customlist,startify#session_list SSave call startify#session_save(0, ) command! -nargs=? -bar -bang -complete=customlist,startify#session_list SDelete call startify#session_delete(0, ) command! -nargs=0 -bar SClose call startify#session_close()