How to start gVim maximized?

Solution 1:

From the Vim wiki:

au GUIEnter * simalt ~x

That'll work on Windows; I'm not sure what key combinations you'd need on Gnome/KDE.

Solution 2:

The best way if you're concerned about cross-platform compatibility is set lines=999 columns=999. I've found it in Vim's Wiki, and despite it's not perfect, it's a best solution if you need to work on different operating systems.

Solution 3:

Trick with:

au GUIEnter * simalt ~x

depends on Windows language.

For my Polish version works:

au GUIEnter * simalt ~s

Where s comes from Mak_s_ymalizuj.

So if ~x doesn't work press ALT+SPACE to open Window menu and check shortcut for Ma_x_imize Window menu option.

Solution 4:

On GNU/Linux

On GNU/Linux, the easiest way is to invoke gvim with the -geometry option. For example:

gvim -geometry 1336x744

This is obviously not handy if you would like to reuse the same start command on different machines.

Here is what I am using now on several machines with different screen dimensions without any issues. Just add it somewhere high up in your .vimrc.

if has("gui_running")
  " GUI is running or is about to start.
  " Maximize gvim window (for an alternative on Windows, see simalt below).
  set lines=999 columns=999
else
  " This is console Vim.
  if exists("+lines")
    set lines=50
  endif
  if exists("+columns")
    set columns=100
  endif
endif

Source: http://vim.wikia.com/wiki/Maximize_or_set_initial_window_size

Solution 5:

You can use maximize.dll plugin for fullscreen veiw on Vim (if you are using Windows). Just copy maximize.dll into vimdirectory/plugin folder.