From 7abdbb5d222970229673484349a51ffc0cd21179 Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 3 Aug 2017 00:24:28 +0200 Subject: vimrc: added fullscreen toggle functionality, restoring fold state not solved --- vimrc | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/vimrc b/vimrc index c83c462..8e1f728 100644 --- a/vimrc +++ b/vimrc @@ -352,12 +352,14 @@ set wildignore+=*.o,*.obj,.git,*.pyc,*~ " Ignore these files when completing "}}} "{{{ Save & Restore -augroup aug:AutoSaveResore +augroup aug:AutoSaveLastSession autocmd! "autocmd VimEnter * silent! source .vim_last_session - "autocmd QuitPre * mksession! .vim_last_session + autocmd QuitPre * execute "mksession! " . $VIMHOME . "/session.last_quit" augroup end +nnoremap :execute "source " . $VIMHOME . "/session.last_quit" + "}}} "{{{ QuickFix @@ -571,8 +573,30 @@ if s:sandbox_enable endfunction command! CC call s:RemoveCStyleComments() + " TODO: correctly save/restore open/closed folds + let s:gIsFullScreen = 0 + let s:gSessionFile = $VIMHOME . "/session." . getpid() + function! s:ToggelFullScreen() + if s:gIsFullScreen + let s:gIsFullScreen = 0 + execute "source" s:gSessionFile + else + execute "mksession! " s:gSessionFile + execute "only" + let s:gIsFullScreen = 1 + endif + endfunction + nnoremap :call ToggelFullScreen() + + augroup aug:CleanUpSessionFile + autocmd! + autocmd QuitPre * call delete(s:gSessionFile) + augroup end + + endif "}}} "% vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1 + -- cgit v1.2.3