by kazinator · 4y ago · 0 comments
vim -S <sessfile>
will recover a session file.I set up these items in my .vimrc to make sessions a little easier to work with:
The + key (which has a useless default role of moving to the next line) is mapped to save the current session:
:nmap + :wa<Bar>exe "mksession! " . v:this_session<CR>
Then, a :S command for creating a new session, e.g. :S foo. :command -nargs=1 S exec "mksession! " . expand('$top/') . expand('<args>')
This relies on a $top variable which I set like this: :let $top=getcwd()
that has to do with https://news.ycombinator.com/item?id=33351155I want sessions to be created in the top directory, rather than the directory of the current buffer.
I actually have in normal mode ,ss for save session and ,so for opening them. Central location of session dirs and that's it. Save session saves everything from files open, positions, tabs, you name it.