Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 6 down vote accepted

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.

share|improve this answer
You could also write this instead of ToggleFullscreen: map <silent> <F11> :call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")<CR> – Daan Bakker 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.

share|improve this answer

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"
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .