Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

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

like image 938
Filippo Alessi Avatar asked Sep 16 '12 15:09

Filippo Alessi


2 Answers

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

like image 172
ZyX Avatar answered Sep 28 '22 03:09

ZyX


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.

like image 23
Mu Mind Avatar answered Sep 28 '22 04:09

Mu Mind