Skip to content

Instantly share code, notes, and snippets.

@iain
Created July 24, 2009 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iain/153928 to your computer and use it in GitHub Desktop.
Save iain/153928 to your computer and use it in GitHub Desktop.
A piece of vimrc
" Save session and close vim by pressing SQ.
" When you open vim again, without arguments, it opens the saved session.
nmap SQ <ESC>:mksession! ~/.vim/Session.vim<CR>:wqa<CR>
function! RestoreSession()
if argc() == 0 "vim called without arguments
execute 'source ~/.vim/Session.vim'
end
endfunction
autocmd VimEnter * call RestoreSession()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment