daveslab
daveslab

Reputation: 10310

How to use VIM to remember open files between sessions?

I use VIM as my main text editor here at work and I often have 10-15 files open at once in a couple of Windows with several tabs, each of which has its own split Windows. I love using VIM, but I hate having to re-do my entire set-up every time the dev server gets bounced or my machine crashes.

Is there a way to get VIM to remember a setup, such as the "project" features in many IDEs? Or am I stuck having to open all the files in the same way each time?

Upvotes: 8

Views: 1882

Answers (2)

Oleksandr Tymoshenko
Oleksandr Tymoshenko

Reputation: 1340

Check help for mksession

Upvotes: 7

Greg Hewgill
Greg Hewgill

Reputation: 992767

Have a look at the :mksession command.

A Session keeps the Views for all windows, plus the global settings. You can save a Session and when you restore it later the window layout looks the same. You can use a Session to quickly switch between different projects, automatically loading the files you were last working on in that project.

Upvotes: 20

Related Questions