diff --git a/autoload/startify.vim b/autoload/startify.vim index 26c7c9a..1a7f6e7 100644 --- a/autoload/startify.vim +++ b/autoload/startify.vim @@ -251,14 +251,27 @@ function! startify#session_write(spath) let &sessionoptions = ssop endtry - if exists('g:startify_session_savevars') || exists('g:startify_session_savecmds') + if exists('g:startify_session_remove_lines') + \ || exists('g:startify_session_savevars') + \ || exists('g:startify_session_savecmds') execute 'split' a:spath + " remove lines from the session file + if exists('g:startify_session_remove_lines') + for pattern in g:startify_session_remove_lines + execute 'silent global/'. pattern .'/delete' + endfor + endif + " put existing variables from savevars into session file - call append(line('$')-3, map(filter(copy(get(g:, 'startify_session_savevars', [])), 'exists(v:val)'), '"let ". v:val ." = ". strtrans(string(eval(v:val)))')) + if exists('g:startify_session_savevars') + call append(line('$')-3, map(filter(copy(g:startify_session_savevars), 'exists(v:val)'), '"let ". v:val ." = ". strtrans(string(eval(v:val)))')) + endif " put commands from savecmds into session file - call append(line('$')-3, get(g:, 'startify_session_savecmds', [])) + if exists('g:startify_session_savecmds') + call append(line('$')-3, g:startify_session_savecmds) + endif setlocal bufhidden=delete silent update diff --git a/doc/startify.txt b/doc/startify.txt index 27a8f8f..113bbb3 100644 --- a/doc/startify.txt +++ b/doc/startify.txt @@ -103,6 +103,7 @@ default values. |g:startify_session_delete_buffers| |g:startify_session_dir| |g:startify_session_persistence| + |g:startify_session_remove_lines| |g:startify_session_savecmds| |g:startify_session_savevars| |g:startify_skiplist_server| @@ -307,6 +308,28 @@ Currently this option does this: - don't check every file if it's readable (stat(2)) - don't filter through the bookmark list +------------------------------------------------------------------------------ + *g:startify_session_remove_lines* +> + let g:startify_session_remove_lines = [] +< +Lines matching any of the patterns in this list, will be removed from the +session file. + +Example: +> + let g:startify_session_remove_lines = ['setlocal', 'winheight'] +< +Internally this simply does: +> + :global/setlocal/delete + :global/winheight/delete +< +So you can use any |pattern|. + +NOTE: Take care not to mess up any expressions within the session file, +otherwise you'll probably get problems when trying to load it. + ------------------------------------------------------------------------------ *g:startify_session_savevars* >