Skip to Content
Modern Vim
book

Modern Vim

by Drew Neil
May 2018
Intermediate to advanced
168 pages
4h 2m
English
Pragmatic Bookshelf
Content preview from Modern Vim
Tip 23Saving and Restoring Sessions

Sometimes you have to restart Vim. Usually this means losing your list of open buffers, as well as any open tab pages or windows. Fortunately, Vim’s session management allows you to save your current workspace so that you can restore it again later.

Saving and Loading Sessions Manually

The source code that accompanies this book includes a webapp directory. Switch to that directory and launch Vim, using the -O flag to open the specified files in vertical splits:

=> $ cd code/webapp
=> $ vim -O app.js test/app-test.js

You should see the app.js and app-test.js files in adjacent windows. Now use the :mksession! command to save the session (:h :mksession):

=> :mksession!

Vim records the current session ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Vim Masterclass

Vim Masterclass

Jason Cannon
Mastering Vim

Mastering Vim

Ruslan Osipov

Publisher Resources

ISBN: 9781680506006Errata Page