parent
69fa3cf9af
commit
85a7168d71
|
@ -14,6 +14,7 @@ let g:autoloaded_startify = 1
|
|||
let s:numfiles = get(g:, 'startify_files_number', 10)
|
||||
let s:show_special = get(g:, 'startify_enable_special', 1)
|
||||
let s:restore_position = get(g:, 'startify_restore_position')
|
||||
let s:delete_buffers = get(g:, 'startify_session_delete_buffers')
|
||||
let s:session_dir = resolve(expand(get(g:, 'startify_session_dir',
|
||||
\ has('win32') ? '$HOME\vimfiles\session' : '~/.vim/session')))
|
||||
|
||||
|
@ -153,6 +154,7 @@ function! startify#session_load(...) abort
|
|||
echo 'There are no sessions...'
|
||||
return
|
||||
endif
|
||||
call startify#session_delete_buffers()
|
||||
let spath = s:session_dir . s:sep . (exists('a:1')
|
||||
\ ? a:1
|
||||
\ : input('Load this session: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string'))
|
||||
|
@ -235,6 +237,20 @@ function! startify#session_delete(...) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" Function: #session_delete_buffers {{{1
|
||||
function! startify#session_delete_buffers() abort
|
||||
if !s:delete_buffers
|
||||
return
|
||||
endif
|
||||
let n = 1
|
||||
while n <= bufnr('$')
|
||||
if buflisted(n)
|
||||
silent execute 'bdelete' n
|
||||
endif
|
||||
let n += 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" Function: #session_list {{{1
|
||||
function! startify#session_list(lead, ...) abort
|
||||
return map(split(globpath(s:session_dir, '*'.a:lead.'*'), '\n'), 'fnamemodify(v:val, ":t")')
|
||||
|
|
|
@ -92,6 +92,7 @@ default values.
|
|||
|g:startify_session_detection|
|
||||
|g:startify_session_autoload|
|
||||
|g:startify_session_persistence|
|
||||
|g:startify_session_delete_buffers|
|
||||
|g:startify_skiplist|
|
||||
|g:startify_skiplist_server|
|
||||
|g:startify_change_to_dir|
|
||||
|
@ -213,6 +214,13 @@ Great way to create a portable project folder.
|
|||
<
|
||||
Automatically update sessions before exiting Vim.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:startify_session_delete_buffers*
|
||||
>
|
||||
let g:startify_session_delete_buffers = 0
|
||||
<
|
||||
Delete open buffers before loading a new session.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*g:startify_change_to_dir*
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue