Simplify buffer deletion for g:startify_session_delete_buffers

This commit is contained in:
Marco Hinz 2018-05-05 14:24:07 +02:00
parent 2cdbe64a7d
commit 423eb03de4
No known key found for this signature in database
GPG key ID: 1C980A1B657B4A4F
2 changed files with 9 additions and 22 deletions

View file

@ -365,22 +365,9 @@ endfunction
" Function: #session_delete_buffers {{{1 " Function: #session_delete_buffers {{{1
function! startify#session_delete_buffers() function! startify#session_delete_buffers()
if !get(g:, 'startify_session_delete_buffers', 1) if get(g:, 'startify_session_delete_buffers', 1)
return silent %bdelete
endif endif
let n = 1
while n <= bufnr('$')
if buflisted(n)
try
silent execute 'bdelete' n
catch
echohl ErrorMsg
echomsg v:exception
echohl NONE
endtry
endif
let n += 1
endwhile
endfunction endfunction
" Function: #session_list {{{1 " Function: #session_list {{{1

View file

@ -317,8 +317,8 @@ Example:
< <
Automatically update sessions in two cases: Automatically update sessions in two cases:
1) Before leaving Vim - Before leaving Vim
2) Before loading a new session via :SLoad - Before loading a new session via :SLoad
This also works for sessions started with: This also works for sessions started with:
> >
@ -329,12 +329,12 @@ This also works for sessions started with:
> >
let g:startify_session_delete_buffers = 1 let g:startify_session_delete_buffers = 1
< <
Delete all listed buffers when loading or closing a session. Delete all buffers when loading or closing a session:
1. When using |startify-:SLoad|. - When using |startify-:SLoad|.
2. When using |startify-:SClose|. - When using |startify-:SClose|.
3. When using |g:startify_session_autoload|. - When using |g:startify_session_autoload|.
4. When choosing a session from the Startify buffer. - When choosing a session from the Startify buffer.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
*g:startify_change_to_dir* *g:startify_change_to_dir*