Is it possible to get gVim to remember window size?

Charles Roper picture Charles Roper · Feb 27, 2009 · Viewed 15.5k times · Source

I know how to set the initial window size in gVim, but how do I get it to automatically restore the window dimensions from last session? Is this even possible?

Answer

user55400 picture user55400 · Feb 27, 2009

Edit: Corrected my answer. The mentioned winsize sessionoption only refers to the vim internal window layout, not the external dimensions.


If you use

:mksession

and load the session on vim startup with

gvim -S Session.vim

you can include the window position and size into the session by including winpos and resize in the sessionoptions, see

:help  'sessionoptions

With autocommands you could even automate the saving and restoring of the session on Vim entry and exit.