Vim Tips Wiki
(Created page with "What to do if the menu bar disappears due to a bug in GNOME, so that gvim-internal means of restoring it don't work. ==The problem: <code>:set guioptions+=m</code> doesn't work!...")
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
  +
{{TipNew
What to do if the menu bar disappears due to a bug in GNOME, so that gvim-internal means of restoring it don't work.
 
  +
|id=1677
  +
|previous=1676
  +
|next=1678
  +
|created=September 8, 2011
  +
|complexity=basic
  +
|author=
  +
|version=7.0
  +
|subpage=/201109
  +
|category1=
  +
|category2=
  +
}}
 
What to do if Vim's menu bar disappears due to a bug in [[wikipedia:GNOME|GNOME]], so that gvim cannot display its menu?
   
==The problem: <code>:set guioptions+=m</code> doesn't work!==
+
==Changing guioptions==
  +
The standard method for displaying or hiding the menu bar is to use these commands in gvim:
 
*<code>:set guioptions+=m</code>&nbsp;&nbsp; enable (display) menu bar
 
*<code>:set guioptions-=m</code>&nbsp;&nbsp; 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 <code>sudo gvim</code>), then see if the menu can be enabled and disabled using the above commands.
The usual (and correct, as far as gvim-internal issues are concerned) method of restoring/hiding the menu bar is:
 
   
  +
==Solution==
:<code>:set guioptions+=m</code> enables the menu bar
 
 
Open a terminal and enter the command:
:<code>:set guioptions-=m</code> disables the menu bar
 
  +
<pre>
 
rm ~/.gnome2/Vim
  +
</pre>
   
 
and/or:
This will work if your menu is turned off within Vim. If that doesn't work and you are using Gnome/Metacity the real issue is probably due to a problem with Gnome trying to dock the menu somewhere you cannot see it. A test to see if this is indeed the issue is to open gvim as root (with <code>sudo gvim</code> and see if the menu is there, and if it is possible to hide/show it with <code>:set guioptions-=m</code>/<code>:set guioptions+=m</code>.
 
  +
<pre>
 
rm ~/.gnome/Vim
  +
</pre>
   
 
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.
   
==The solution==
+
==Comments==
   
  +
<ul>
Open a terminal and do
 
   
  +
<li>Deleting the file <code>~/.gnome2/Vim</code> worked, but the problem recurs. Examining this file shows that the problem is that the toolbar and the menubar are overlayed:
<pre>rm ~/.gnome2/Vim</pre>
 
  +
<pre>
  +
[Placement]
  +
Dock=Toolbar\\0,0,0,0\\Menubar\\0,0,0,0
  +
</pre>
   
  +
Change this to:
and/or
 
  +
<pre>
  +
[Placement]
  +
Dock=Toolbar\\0,1,0,0\\Menubar\\0,0,0,0
  +
</pre>
   
  +
This solves the problem. The question however remains, namely how does this file get repeatedly corrupted in the first place. --December 29, 2011
<pre>rm ~/.gnome/Vim</pre>
 
  +
</li>
   
  +
<li>If deleting <code>~/.gnome2/Vim</code> does not work, check the <code>.vimrc</code> 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</li>
i.e. 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.
 
  +
</ul>
   
  +
==On Ubuntu==
I put this info here because it was hard to find, and it ought to be found in a place where people look for solutions to Vim issues. If this is improper, pleas make it available in some place proper!
 
   
  +
<ul>
   
  +
<li>The disappearance of the menu bar in GVim is not a bug in GNOME; it's deliberate on the contrary, and a clever idea from the developers of the Unity project. The goal is one of optimization : it minimize the footprint on the desktop and maximize the editable surface of the windows opened in GVim. The left part of the global menus bar in Unity hold the "Application Indicators" and act as the GVim's menu bar for the ever sole active window, instead of being needlessly repeated for all the windows.</li>
==References==
 
<!-- Put any help links you want here in a list as follows: -->
 
<!-- *{{help|toc}} -->
 
   
  +
<li>For the one who prefer not using the mouse, the <code><F10></code> key unroll the leftmost menu of the active window of GVim. Navigation is done within a menu with the up and down arrows, and from a menu to the other with the left and right arrows. Selection is done by pressing the <code><Enter></code> key, and escape by pressing <code><Esc></code>.
None, as this isn't really a Vim issue, and links to blogs and homepages are forbidden.
 
   
  +
It worth noting the keyboard shortcuts hints appearing to the right (left for bidirectional languages) of the entries in the menus, which hints are hidden in the Unity global menus.
==Comments==
 
  +
</li>
  +
  +
<li>The head titles of the GVim's menus being <code>f</code>ILE, <code>e</code>DIT, <code>t</code>OOLS, <code>s</code>YNTAX, <code>b</code>UFFERS, <code>w</code>INDDOWS and <code>h</code>ELP, it yields the mnemonic "fetsbwh" which in turn ease access to any specific menu by pressing keys <code><Alt f></code> for the File menu, <code><Alt e></code> for the Edit menu, and so on up to the Help menu <code><Alt h></code>. Navigation, selection and escape are as usual.</li>
  +
  +
<li>For the one who stick to the GVim's menu bar being attached to the window, start GVim with the terminal command :
  +
<pre>
  +
$ UBUNTU_MENUPROXY="" gvim
  +
</pre>
  +
  +
The variable is usually set to "libappmenu.so" (in /usr/lib/indicators3/7/). Clearing it launch GVim without using Unity global menus. -- Jan 2014</li>
  +
  +
</ul>

Revision as of 15:17, 14 January 2014

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

  • 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

  • The disappearance of the menu bar in GVim is not a bug in GNOME; it's deliberate on the contrary, and a clever idea from the developers of the Unity project. The goal is one of optimization : it minimize the footprint on the desktop and maximize the editable surface of the windows opened in GVim. The left part of the global menus bar in Unity hold the "Application Indicators" and act as the GVim's menu bar for the ever sole active window, instead of being needlessly repeated for all the windows.
  • For the one who prefer not using the mouse, the <F10> key unroll the leftmost menu of the active window of GVim. Navigation is done within a menu with the up and down arrows, and from a menu to the other with the left and right arrows. Selection is done by pressing the <Enter> key, and escape by pressing <Esc>. It worth noting the keyboard shortcuts hints appearing to the right (left for bidirectional languages) of the entries in the menus, which hints are hidden in the Unity global menus.
  • The head titles of the GVim's menus being fILE, eDIT, tOOLS, sYNTAX, bUFFERS, wINDDOWS and hELP, it yields the mnemonic "fetsbwh" which in turn ease access to any specific menu by pressing keys <Alt f> for the File menu, <Alt e> for the Edit menu, and so on up to the Help menu <Alt h>. Navigation, selection and escape are as usual.
  • For the one who stick to the GVim's menu bar being 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