From ab8c15eb4c0b4883ab216c9375cbcead7e70d541 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Sat, 25 May 2013 11:36:02 +0200 Subject: [PATCH] SSave: check for empty input --- autoload/startify.vim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/autoload/startify.vim b/autoload/startify.vim index 656a5d7..ed959d1 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -155,10 +155,16 @@ function! startify#session_save(...) abort return endif endif - let spath = s:session_dir . startify#get_separator() . (exists('a:1') - \ ? a:1 - \ : input('Save under this session name: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string')) - \ | redraw + if exists('a:1') + let spath = s:session_dir . startify#get_separator() . a:1 + else + let i = input('Save under this session name: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string') + redraw + if empty(i) + echo 'You gave an invalid name!' + return + endif + endif let spath = s:escape(spath) if !filereadable(spath) execute 'mksession '. spath | echo 'Session saved under: '. spath