Vim Recipes GUI (GVim) Maximising Screen Space

Maximising Screen Space

Problem

The toolbar, menubar, and other GUI artifacts take up too much of your screen; you want to hide them.

Solution

Modify the guioptions variable. Gvim decides which elements of the GUI to display based on the value of guioptions. This is a series of letters, each of which refer to some specfic element. Some examples follow:

So, to hide the menu bar, toolbar, and scrollbars you could use :set guioptions-=mTrlb. To display a hidden element use += instead, e.g. :set guioptions+=T.

Discussion

If you decide that you want to restore one or more of these elements you can simply execute :set guioptions+=m, for example. This can be cumbersome, however, as it requires you to remember the significance of each letter.

The following stanza in your gvimrc assigns <F11> to toggle the display of extraneous GUI elements:

function ToggleGUICruft()
  if &go==''
    exec('se go=mTrL')
  else
    exec('se go=')
  endif
endfunction
map <F11> <Esc>:call ToggleGUICruft()<cr>