I would like to open gVim in full screen mode, i.e. without upper and lower panes.
I try to achieve it editing

System -> Preferences -> Keyboard shortcuts->Window management -> Toggle fullscreen mode

but the shortcut doesn't work in any application.

How can I achieve it?


Under the metacity window manager, fullscreen display should work with the standard shortcut defined as you describe in your question, but if you have anything other than "None" selected under System -> Preferences -> Appearance -> Visual Effects, you'll get the compiz window manager. I couldn't find a way to make the full screen shortcut work there either.

You could use the wmctrl utility to send a manual request for full screen mode.

wmctrl -r gvim add,fullscreen

And to revert:

wmctrl -r gvim remove,fullscreen

This works from within Vim as well, so you can map e.g. F11 to toggle full screen mode:

map <silent> <F11>
\    :call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")<CR>

To get the complete fullscreen effect, you can hide tool and menu bar:

set guioptions-=T guioptions-=m

I personally wouldn't miss them but if you do prefer to have them in non-fullscreen, you'd probably best handle the toggling inside a function. (Check the edit history for an example.)

Finally a default setting you may have tweaked as you speak of a bottom pane is 'laststatus'. Reset it to not show the status line when there is only one window:

set laststatus&

Or preferably find where it's set to non-default in your .vimrc and remove it there.

  • 1
    You could also write this instead of ToggleFullscreen: map <silent> <F11> :call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")<CR> Mar 3 '13 at 20:48
  • Much better! Replaced the function with your mapping.
    – peth
    Mar 7 '13 at 23:39

If you set

set columns=120
set lines=40

in your .gvimrc you will get a gvim of the specified size. IIRC from the vim manpage, gvim will never create itself bigger than your screen, so setting these to very large values will create an essentially fullscreen gvim.


On gvim 7.2, I was not able to use the method of user112553 as v:windowid is not supported. However, this also works, and probably easier:

:exe "!wmctrl -r ".v:servername." -b toggle,fullscreen"

Automated, upon starting gvim

Place the following line in gvimrc, for a foolproof fullscreen at gvim startup:

autocmd GUIEnter * call system("wmctrl -ir " . v:windowid . " -b add,fullscreen")

Or, if you rather prefer maximised:

autocmd GUIEnter * call system("wmctrl -ir " . v:windowid . " -b add,maximized_vert,maximized_horz")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.