Skip to content

Instantly share code, notes, and snippets.

@smathy
Created September 16, 2011 17:22
Show Gist options
  • Save smathy/1222608 to your computer and use it in GitHub Desktop.
Save smathy/1222608 to your computer and use it in GitHub Desktop.
function! Make_vimsession()
execute("mksession! " . g:vimsession)
endfunction
command! SS call Make_vimsession()
function! Set_vimsession()
let cwd = getcwd()
while ! ( isdirectory( cwd . "/.git" ) || cwd == "/" )
let cwd = simplify( cwd . "/.." )
endwhile
let g:vimsession = cwd . "/.git/.vimsession"
endfunction
au VimEnter * call Set_vimsession()
au VimLeave * call Make_vimsession()
nmap ZZ :xa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment