How can I open gVim in full screen mode in GNOME?

3

1

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?

gennad

Posted 2011-03-31T03:29:03.933

Reputation: 339

Answers

6

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.

peth

Posted 2011-03-31T03:29:03.933

Reputation: 7 990

1You could also write this instead of ToggleFullscreen: map <silent> <F11> :call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen")<CR> – Daan Bakker – 2013-03-03T20:48:06.187

Much better! Replaced the function with your mapping. – peth – 2013-03-07T23:39:57.473

1

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.

richo

Posted 2011-03-31T03:29:03.933

Reputation: 359

1

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"

Ethan Collins

Posted 2011-03-31T03:29:03.933

Reputation: 113

0

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")

Serge Stroobandt

Posted 2011-03-31T03:29:03.933

Reputation: 1 152