Vim Tips Wiki
Register
Advertisement
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Tip 1677 Printable Monobook Previous Next

created September 8, 2011 · complexity basic · version 7.0


What to do if Vim's menu bar disappears due to a bug in GNOME, so that gvim cannot display its menu?

Changing guioptions

The standard method for displaying or hiding the menu bar is to use these commands in gvim:

  • :set guioptions+=m   enable (display) menu bar
  • :set guioptions-=m   disable (hide) menu bar

If you are using Gnome/Metacity, a problem may prevent the menu bar from being displayed: Gnome tries to dock the menu in a place where you cannot see it. A test to see if this is the issue is to open gvim as root (with sudo gvim), then see if the menu can be enabled and disabled using the above commands.

Solution

Open a terminal and enter the command:

rm ~/.gnome2/Vim

and/or:

rm ~/.gnome/Vim

That is, delete the file under your home directory where Gnome keeps its settings for Vim. It will be recreated when you run gvim again. With luck, the menu will be displayed again.

Comments

Deleting the file ~/.gnome2/Vim worked, but the problem recurs. Examining this file shows that the problem is that the toolbar and the menubar are overlayed:

[Placement]
Dock=Toolbar\\0,0,0,0\\Menubar\\0,0,0,0

Change this to:

[Placement]
Dock=Toolbar\\0,1,0,0\\Menubar\\0,0,0,0

This solves the problem. The question however remains, namely how does this file get repeatedly corrupted in the first place. --December 29, 2011.

This works on Ubuntu 14.04, June 2014. --July 5, 2014

If deleting ~/.gnome2/Vim does not work, check the .vimrc file permission to make sure the current user can read it. If GVim is installed by root, or the .vimrc file is copied from a flash key, its permission may prevent other users from reading it when starting GVim. When that happens all custom settings in .vimrc, including the menu, do not apply, causing the menu not to be shown. --Oct 2013


On Ubuntu Xenial, using the vim-gtk3 package rather than vim-gnome solves the problem. This is due to a recent version of compiz causing issues with unity -- 5 Apr 2018

On Ubuntu

  • If you are using Unity and want GVim's menu bar attached to the window, start GVim with the terminal command:
$ UBUNTU_MENUPROXY="" gvim 

The variable is usually set to "libappmenu.so" (in /usr/lib/indicators3/7/). Clearing it launch GVim without using Unity global menus. -- Jan 2014

Advertisement