Reputation: 32066
A recent crash prompted this question - I had two gui windows open. Is there any way with sessions or plugins to save the both window configurations and positions and restore it on fully quitting / reopening macvim? I think that would be super useful but I can't find anything through Google about it. If I make a session in one window it only saves for that one.
Upvotes: 1
Views: 1278
Reputation: 393064
Read up on sessions and views (like romainl mentioned):
:h :mksession
:h :mkview
These will do about what you want. Like he mentioned, though you will want to keep different session files per vim instance. E.g.:
:mksess! instance_1.vim
in one, and
:mksess! instance_2.vim
in the other instance.
Reload sessions like:
gvim -S instance_1.vim&
gvim -S instance_2.vim&
To assign a key to easily save the 'current' session without further thinking:
:nnoremap <F2> :exe "mksession! " . v:this_session<CR>
Now pressing F2 will save the active session (e.g. the one that was loaded).
Upvotes: 1
Reputation: 196556
GVim or MacVim? It's not relevant to your problem but the title of your question doesn't reflect its subject.
In GUI Vim, GUI windows are separate instances without much knowledge of each other and no shared processes. What you want doesn't seem to be possible from within Vim itself. MacVim runs as a single process but each GUI window is still a separate instance. Maybe you'll have some third party options there.
It won't really help with your two GUI windows but did you read :h :mksession
and :h :mkview
?
Upvotes: 2