vim drops
Published in

vim drops

Vim Sessions

Plus: A custom command to save the session, the files, and then exit.

Understanding the Commands:

To Save a Session (:mksession, :mks)

To Restore a Session (:source, :so, vim -S)

Example Use Cases:

Daily Saving Sessions of an Ongoing Project

Maintaining Stable Projects


To git or Not To git?

  • Add Sessions.vim to your project’s .gitignore file. - Since this auto-created file is now more related to your personal workflow on the project, it could bring more pain than help if committed to the project’s repo.
  • Commit PriceUpdate.vim (example) to the project’s repository. - If you create a custom session file to help quick maintenance on a stable project, it may be worth sharing with others since it could help anyone to dive in and make specific work without searching for files and content inside the project.

An Alias to Save the Session, the Modified Files, and Exit

command! Xs :mks! | :xa "save the session, save modified files, and exit

Do Not Miss It!

Link to the original post:

Useful links & references:


  • is the TRUE and FOREVER FREE home for the previously used publication. At you’ll always find all posts without restrictions.
  • Big thanks 🙌 to jovica for reviewing this post!
  • If you have any doubts or tips about this article, I’d appreciate to know and to discuss it on the comments section.
  • Do you have any other vim tips? Would you like to publish that on this blog? Please send an email.
  • As English is not my native language, I apologize for the errors. Corrections are welcome.
  • Contact: vim [@] alldrops [.] info.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jonas B. Rossi

Project Manager | Software Engineer | Civil Engineer | MBA | #vim #cli addicted