gVim on Ubuntu – Running in Fullscreen

I admit, I am a fan of working in full-screen. Whilst coding, or writing I don’t want to see anything else unless I explicitly ask for it. If I want the time, or to see the screaming requests of clients I will make the point of switching to that information.

I love my Vim. I love Vim to the point of a scary obsession. I use it on Windows, I use it on OS X and I use it on Linux, both terminal and desktop.

But I have a confession to make. gVim on Ubuntu Desktop has been … upsetting me. You see, on OS X when I full-screen MacVim, OS X’s chroming disappears, the application full screens elegantly, and I am left in black bliss. In Windows, I’ve managed the same with the help of a little plugin.

But Ubuntu, Ubuntu. How my heart weeps for thee. My first forays into black screen bliss left me with this:

Title bar across the top, and what on earth is going on in the bottom right? My delicate eyes can not suffer the indignity of this working environment. But what to do, what to do?

Window Background

The problem in the bottom right is down to the gtk background leaking over, since gVim’s window size calculation is based on the number of lines displayed. The maths makes sense, but it is still an affront to the eyes. A small addition to the .gtkrc-2.0 file resolves this:

style "vimfix" {
  bg[NORMAL] = "#1d1d1d" # Set the background to your vim theme background.
}
widget "vim-main-window.*GtkForm" style "vimfix"

(Thanks to this post on Ask Ubuntu for help with this)

Running In Full-screen

Removing the chroming involves running gVim in full-screen mode, which Unity supports but does not make straightforward. Depending on whether you’re running Unity or Unity 2D, you’ll need two different approaches:

Unity

Install the CompizConfig Settings Manager and Comiz Plugins Extra with the following:

sudo apt-get install compizconfig-settings-manager compiz-plugins-extra

Open CompizConfig Settings Manager -> Extra WM Actions -> Toggle Full-screen Set a shortcut you’re comfortable with. I use Ctrl+F11.

Unity 2D

Open the Keyboard Settings Panel -> Shortcuts -> Windows (on left list) -> Toggle Full-screen Mode

Set a shortcut you’re comfortable with. I use Ctrl+F11.

Finally, switch back to gVim and smack that key combo. Watch the rest of the world fade away.

If everything has gone to plan, you too should be staring into the black (or colour of your choice) abyss.