Last active
December 26, 2015 09:59
-
-
Save mhinz/7133825 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function! s:session_write(spath) | |
| let ssop = &sessionoptions | |
| try | |
| set sessionoptions-=options | |
| execute 'mksession!' a:spath | |
| catch | |
| execute 'echoerr' string(v:exception) | |
| finally | |
| let &sessionoptions = ssop | |
| endtry | |
| if exists('g:startify_session_savevars') || exists('g:startify_session_savecmds') | |
| " put these commands into the session file | |
| let cmds = get(g:, 'startify_session_savecmds', []) | |
| " put these existing variables into the session file | |
| let vars = map(filter(get(g:, 'startify_session_savevars', []), 'exists(v:val)'), | |
| \ '"let ". v:val ." = ". strtrans(string(eval(v:val)))') | |
| let sessionlines = readfile(a:spath) | |
| call writefile(sessionlines[:-4] + vars + cmds + sessionlines[-3:], a:spath) | |
| endif | |
| endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment