Filippo Alessi
Filippo Alessi

Reputation: 605

How to maximize vim's windows on startup with .vimrc?

Can I add something to my .vimrc or .gvimrc to make gvim always start up in a maximized GUI window?

Upvotes: 13

Views: 8577

Answers (3)

SY_13
SY_13

Reputation: 113

You can set the initial size of the Vim Window by adding the following line to ~/.vimrc :

set lines=50 columns=100(just an example)

I set my vim to my screen resolution, i.e. set lines=768 columns=1366. Now my Vim editor automatically launches in fullscreen.

Upvotes: 0

ZyX
ZyX

Reputation: 53644

On linux with most window managers and wmctrl installed you can maximize Gvim using the following command:

call system('wmctrl -i -b add,maximized_vert,maximized_horz -r '.v:windowid)

. Note: I am intentionally avoiding -b add,fullscreen mentioned in man wmctrl as it means different thing: at least in fluxbox that means that from now on this desktop you can see only either gvim or something else at a time, not both, and gvim is left without window decorations (not that I really care about them). E.g. if you popup yakuake* gvim disappears until yakuake hides.

* terminal emulator, pops like console in some FPS games

Upvotes: 11

Mu Mind
Mu Mind

Reputation: 11204

It looks like if you're using Windows, it's as easy as adding this line into your .vimrc:

au GUIEnter * simalt ~x

(type :help maximize or :help win16-maximized for details)

Apparently there's no standard way to do it on other platforms from your vimrc. The simplest trick without knowing which platform is to add

set lines=999 columns=999

to your .gvimrc. There are a few other tricks that can help at the Vim Wiki's Maximize or set initial window size page.

Upvotes: 12

Related Questions