I'd like to have my editors give me as much screen real estate as possible since it increases my ability to see most of the code at once.

The problem is that gvim seems to give me either an 80x25 window or remember the last non-maximised size, depending on how I invoke it.

So, how can I force it to be as large as possible, irrespective of any remembered state?

  • I will in fact recommand the plugin github.com/xolox/vim-shell, which works for gvim on win32 and win64 both, with <F11> Toggle between Fullscreen/normal mode
    – van abel
    May 12, 2017 at 2:59

4 Answers 4


You can put this line:

autocmd GUIEnter * simalt ~x

at the end of your gvimrc file.

This method uses the autocmd feature to weave its magic. The command autocmd GUIEnter * specifies a command to run after successfully starting the GUI for a file pattern of * (any file).

The command it will execute, simalt ~x (in Windows variants of vim only), will simulate the keystroke Alt Spacebarx, which are the keystrokes that will maximise the window.

You can also use the shortened version:

au GUIEnter * sim ~x

but I prefer fully expanded commands myself, especially since it's the sort of thing you set and forget, only entering once when installing vim onto a Windows system.

Keep in mind that this is simulating keystrokes in order to achieve its ends. On English versions, it will work fine since Alt-SpaceX is how you maximise a window.

If that doesn't work for you, you should investigate the keystrokes in whatever locale you're using. For example, the French version will use Agrandir (enlarge) with the n as the control keystroke, so the command you would need there is:

autocmd GUIEnter * simalt ~n

(which would actually minimise your window in English).

If you're some other (non-English, non-French) variant, just press Alt-Space on a window to bring up the system menu, and find out what key should be used (it should be underlined).

To find your gvimrc file for adding whatever command you need, you can enter:

:echo $VIM
:echo $HOME

and you should get a list of startup files and variables like:

system gvimrc file = "$VIM/gvimrc"
  user gvimrc file = "$HOME/_gvimrc"

C:\Program Files (x86)\Vim
  • Your shortened version of the autocmd is missing the *.
    – jamessan
    Feb 24, 2015 at 3:22
  • This method doesn't work for me: instead of maximizing the window it opens a pop-up menu allowing to restaure, move, minimize, maximize(...) the window. I'm using Windows 7 SP1 and gvim 7.4.711. How can I make it work?
    – statox
    May 20, 2015 at 7:48
  • @statox, that's what you'd see if you left off the x from the end. Make sure you have the full text au GUIEnter * sim ~x.
    – user579
    May 20, 2015 at 7:52
  • @paxdiablo I'm not sure to understand I copied the full line (both long and short version) from au to ~x. Is there a whitespace caracter I'm missing or something like that?
    – statox
    May 20, 2015 at 7:57
  • @statox, when you have a gvim window open and you mouse-click the system button (the vim icon most top-left, above the file menu), do you see a maximize? When that system menu is open, does it maximise when you press x?
    – user579
    May 20, 2015 at 8:06

In alternative to the maximized window, why do not gain more space for a full vim multiwindows editing experience with an autostart FULL SCREEN mode? ;-)

FULL SCREEN screenshot of the final result (= ALL THE VIDEO pixels capacity): video full screen screenshot

In my opinion that's better than a windows maximize: a complete FULL SCREEN (as I used to do with puTTY with ALT-Enter when editing on remote unix terminal...)

I explain how to:

Step 1

Install the excellent beautiful utility to allow full screen use in gvim on Windows:


You have to download DLL file gvimfullscreen.dll and put it in the same directory where gvim.exe is ($VIM/vim74 with gVim release 7.4). To download the DLL (without using git):


Step 2

Edit .vimrc file (inside vim: :e $HOME/.vimrc), inserting these commands to autostart full screen and allowing a F11 function key to toggle modes among 3 states: full screen, window maximized, original/default windows size:

"run the command immediately when starting vim
autocmd VimEnter * call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)

" activate/deactivate full screen with function key <F11>  
map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>

Step 3

Edit .gvimrc file (inside vim: :split $HOME/.gvimrc) inserting these commands to avoid menu bar and useless stuff:

set guioptions-=m  "remove menu bar
set guioptions-=T  "remove toolbar
set guioptions-=r  "remove right-hand scroll bar
set guioptions-=L  "remove left-hand scroll bar

From :help 'lines':

Number of lines of the Vim window.
When Vim is running in the GUI or in a resizable window, setting this option will cause the window size to be changed.
You can use this command to get the tallest window possible:
:set lines=999

The columns option does the same, except for the width (in characters).

So you could, for example, put this in your vimrc file:

set lines=55
set columns=120

This is not the same as being maximized (even if you use the 999 value as described above), since "being maximized" is a special flag put on the window, and subtly changes some operations (like moving), but it should solve your problem of having a small 80x25 window size by default.

  • That's not too bad, though it gives a 234x56 window on my system whereas maximising gives 236x57. Still, being short two columns and one row at that size is not too much of an issue, especially for something that may work in non-Windows platforms as well, though I haven't actually tested it. I'll have a look tonight when I get home to my beloved Debian box :-)
    – user579
    Feb 20, 2015 at 7:10
  • With my Debian, the default window is 200x50, setting both lines and columns to 999 in any of vim itself, rc file or with gvim -c 'set them' gives me 236x61 and maximising gives 237x61, so even closer than under Windows. Interestingly, gvim -geometry 999x999 gives me a maximised window at the slightly larger size so that may be better for non-Windows though I suspect it'll be harder to ensure all invocation methods use that. Pity there's not a simalt type thing for nonWin platforms.
    – user579
    Feb 22, 2015 at 2:20
  • Still, it's worth some rep since it comes close enough, and is more portable than the win-only method. By the way, using 9999x9999 as geometry freaks out vim since it doesn't like windows with dimensions over 64K pixels (geometry is character cells in this case rather than pixels). 999x999 seems to work okay. Not sure how this would go in a multi-monitor systems.
    – user579
    Feb 22, 2015 at 2:22
  • Yeah, this method isn't perfect, but like you mentioned, it's cross-platform, and it may also be faster (running commandline-tools on startup can cause a bit of a delay on Windows Vim, at least, that was the case when I used it a few years ago). Feb 23, 2015 at 21:18
  • Setting the columns/lines to 160 x 42 gives a window shape approximating the golden ratio, and you get the awesomeness of 42 !
    – roblogic
    Mar 30, 2015 at 4:50

In addition to the gVim-specific commands in the other answers, there are a couple standard Windows features to launch any application maximized.

If you are staring gVim from a shortcut, such as from the Start Menu or Desktop, you can change the shortcut properties to start Vim maximized. Right-click the shortcut, choose Properties, and select Maximized from the Run drop-down list. However, this will only affect that shortcut, so gVim will still open in a small window if launched from another shortcut, the Run dialog box, or the command line.

If you are starting gVim from the command line or a batch file, you can use CMD’s start command: start "" /max "C:\Program Files (x86)\Vim\vim73\gvim.exe". (The "" is required if the path to gvim.exe is quoted. If you use an unquoted path without spaces, you can omit it: start /max C:\Progra~2\Vim\vim73\gvim.exe.)

  • I don't how what the default start command is, but I overwrote my PATH and now mingsys's start is there, so beware you're running the right one Jan 2, 2017 at 2:18
  • I tried this ("from a shortcut ... select Maximized"). The window flashed and then appeared the same size as it had just from starting it from a DOS cmd shell. To be fair, I have commands in my .vimrc that explicitly set a size (lines/columns) so I suspect the latter is overriding the attempt to maximize.
    – rich p
    Mar 29, 2018 at 13:27
  • This sort of thing also exists as a function of some Linux window managers. For example, I like my Vim windows to be full-height, but two of my monitors are 1024px tall, while the centre one is 1080px tall. Setting Vim to start vertically maximized using KDE's "Window Rules" control panel ensures that gVim will resize to match as it's moved from monitor to monitor. (It also has the added benefit of overriding the lines setting, so I can leave that in my gvimrc as a fallback for systems where I didn't set up such a tweak.)
    – ssokolow
    Nov 16, 2019 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.