From 423eb03de45067c8f5bb96e510cb65d9f17df1d0 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Sat, 5 May 2018 14:24:07 +0200 Subject: [PATCH] Simplify buffer deletion for g:startify_session_delete_buffers --- autoload/startify.vim | 17 ++--------------- doc/startify.txt | 14 +++++++------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index 259ea2c..b67b4db 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -365,22 +365,9 @@ endfunction " Function: #session_delete_buffers {{{1 function! startify#session_delete_buffers() - if !get(g:, 'startify_session_delete_buffers', 1) - return + if get(g:, 'startify_session_delete_buffers', 1) + silent %bdelete 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 " Function: #session_list {{{1 diff --git a/doc/startify.txt b/doc/startify.txt index 96e98b8..a6e5a85 100644 --- a/doc/startify.txt +++ b/doc/startify.txt @@ -317,8 +317,8 @@ Example: < Automatically update sessions in two cases: - 1) Before leaving Vim - 2) Before loading a new session via :SLoad + - Before leaving Vim + - Before loading a new session via :SLoad 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 < -Delete all listed buffers when loading or closing a session. +Delete all buffers when loading or closing a session: - 1. When using |startify-:SLoad|. - 2. When using |startify-:SClose|. - 3. When using |g:startify_session_autoload|. - 4. When choosing a session from the Startify buffer. + - When using |startify-:SLoad|. + - When using |startify-:SClose|. + - When using |g:startify_session_autoload|. + - When choosing a session from the Startify buffer. ------------------------------------------------------------------------------ *g:startify_change_to_dir*