From b4b0dbae221da5828978b8874f189c84f12285b7 Mon Sep 17 00:00:00 2001 From: Mike Anderson Date: Thu, 2 May 2013 15:06:18 -0500 Subject: [PATCH 1/2] check if session dir contains files --- autoload/startify.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/startify.vim b/autoload/startify.vim index dad1b95..93effc5 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -37,6 +37,10 @@ function! startify#delete_session(...) abort echo 'The session directory does not exist: '. g:startify_session_dir return endif + if strlen(startify#get_session_names_as_string('')) == 0 + echo 'There are no sessions...' + return + endif let spath = g:startify_session_dir . startify#get_separator() . (exists('a:1') \ ? a:1 \ : input('Delete this session: ', '', 'custom,startify#get_session_names_as_string')) From 664ad7fa570fb8a216e4731d0247a75bfcb44a60 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Thu, 2 May 2013 22:25:47 +0200 Subject: [PATCH 2/2] check if session dir contains files pt2 --- autoload/startify.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index 93effc5..88fea58 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -36,8 +36,7 @@ function! startify#delete_session(...) abort if !isdirectory(g:startify_session_dir) echo 'The session directory does not exist: '. g:startify_session_dir return - endif - if strlen(startify#get_session_names_as_string('')) == 0 + elseif empty(startify#get_session_names_as_string('')) echo 'There are no sessions...' return endif @@ -92,6 +91,9 @@ function! startify#load_session(...) abort if !isdirectory(g:startify_session_dir) echo 'The session directory does not exist: '. g:startify_session_dir return + elseif empty(startify#get_session_names_as_string('')) + echo 'There are no sessions...' + return endif let spath = g:startify_session_dir . startify#get_separator() . (exists('a:1') \ ? a:1