UPDATE: for linux users, I've found much better solution that really does maximize the window: https://stackoverflow.com/questions/12448179/how-to-maximize-vims-windows-on-startup-with-vimrc
The only dependency is wmctrl
, but it worths installing.
So, for windows I use maximize.dll plugin (as already mentioned by @fatihturan), and for linux I use wmctrl
. Great!
(but I really can't understand why in 2014 gvim doesn't have this feature out-of-the-box)
Old answer:
For me, plain hack :set lines=999 columns=999
works badly on my Linux Mint MATE with two monitors. I have usually gvim opened on the secondary monitor, there're no taskbar, so, Vim should occupy the whole screen. But if I do :set lines=999 columns=999
, gvim shrinks these values to the size of primary monitor, therefore, there are a small area below gvim window unused. It's better if I set real lines/columns count: just maximize your window "by hand" and type :set lines?
and :set columns?
, to get needed values. Since I use two monitors, I also need to specify window position, so, type :winpos
to get current window position.
And secondary, it's better not just put these settings to the .vimrc
, but execute them when gui is loaded.
So, final recipe:
1) maximize your gvim by hand and type three commands to get actual values: :winpos
, :set lines?
and :set columns?
.
2) add this to .vimrc
:
function Maximize()
" put your actual values below
winpos 0 0
set lines=78
set columns=237
endfunction
autocmd GUIEnter * call Maximize()