sponsor Vim development Vim logo Vim Book Ad

obsession.vim : Continuously updated session files

 script karma  Rating 274/98, Downloaded by 1911  Comments, bugs, improvements  Vim wiki

created by
Tim Pope
 
script type
utility
 
description
Vim features a :mksession command to write a file containing the current state of Vim: window positions, open folds, stuff like that.  For most of my existence, I found the interface way too awkward and manual to be useful, but I've recently discovered that the only thing standing between me and simple, no-hassle Vim sessions is a few tweaks:

* Instead of making me remember to capture the session immediately before exiting Vim, allow me to do it at any time, and automatically re-invoke :mksession immediately before exit.
* Also invoke :mksession whenever the layout changes (in particular, on BufEnter), so that even if Vim exits abnormally, I'm good to go.  If I load an existing session, automatically keep it updated as above.
* If I try to create a new session on top of an existing session, don't refuse to overwrite it.  Just do what I mean.  If I pass in a directory rather than a file name, just create a Session.vim inside of it.
* Don't capture options and maps.  Options are sometimes mutilated and maps just interfere with updating plugins.

Use :Obsess (with optional file/directory name) to start recording to a session file and :Obsess! to stop and throw it away.  That's it.  Load a session in the usual manner: vim -S, or :source it.

https://github.com/tpope/vim-obsession
 
install details
Extract in ~/.vim (~\vimfiles on Windows).
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
obsession.zip 1.0 2013-03-11 7.0 Tim Pope Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github