Remember current session in Vim

Moving from such an excellent IDE as Visual Studio is hard and moving from IDE to just a text editor is even harder. And if the text editor is Vim you might call it a madness!

One feature thing that drove me crazy was closing all the tabs I had opened without restoring them the next session. But as I understood, you can achieve anything with Vim.

So, when you have all your tabs open you can save (or overwrite) your current session

:mksession! ~/your_session_name.vim

and when you want to restore it from command line, simply type

gvim -S ~/your_session_name.vim

or if you want to do it from another opened Vim you can with

:source ~/your_session_name.vim

Your tabs, buffers, working directory – everything is restored, very neat!


Would you like to get the most interesting content about programming every Monday?
Sign up to Programming Digest and stay up to date!