Rotating Header Image


Vim Sessions

Well, you learn something new every day.

Nowadays, tabbing are becoming pervasive… Firefox has them, consoles have them, and since version 7, vim has them. This often leads to 6-7 tabs open in my vim editor with different files related to one project, the same project that I’m often working on. This means that every time I reopen VIM, I get to nicely do “tabe file” “tabe file2″ …

Looking around a bit, I found out about sessions in vim which are great. They allow you to save your current system. After playing around a bit, because they seem to enjoy saving too much, I finally abstracted the following nice piece of functionality to my ~/.vimrc:

set sessionoptions=blank,buffers,curdir,folds,help,resize,tabpages,winsize
map :mksession! ~/.vim/.session
map :source ~/.vim/.session

First of all, I change my sessionsoptions as I do not want to save the ‘options’ (this would save all my shortcuts from the latex-suite while that is not necessary). Secondly, I added ‘resize’ as I would like to get back the original window size. The rest is all existent in the default setting of sessionoptions. Then I define some shortcuts to easily save and reload my session with CTRL+Q for saving(q from quit…) and CTRL+S for reloading (as CTRL+R was already taken).

Happy vimming!