Vim Tips Wiki
No edit summary
 
No edit summary
Line 1: Line 1:
 
{{review}}
 
{{review}}
 
{{Tip
 
{{Tip
|id=259
+
|id=665
|title=removing the toolbar (icons) from gvim
+
|title=Hide & Toggle GUI widgets
|created=June 12, 2002 18:52
+
|created=February 27, 2004 13:17
 
|complexity=basic
 
|complexity=basic
|author=Ali Rizvi
+
|author=D. Bron
|version=6.0
+
|version=5.7
|rating=31/26
+
|rating=26/14
 
|text=
 
|text=
  +
If you like your GUI clean, but want the option to access all its power, then you might like this tip.
Change good or bad usually encounters interia from people in excepting it.
 
   
gvim 6.0 is the first version that introduced the icons shortcut in shape of a toolbar under the menu.
 
   
when we upgraded to the new and improved vim 6.1 from vim 5.7 some of people in our company encountered some problems with their syntax highlighting
 
   
  +
The variable "guioptions" determines what GUI widgets are visible (see :help guioptions). I personally prefer to have as few widgets visible as possible, until I need them. To that end, I have the following in my vimrc (thanks to Tim Chase):
and some of them objected on the new toolbar which displayed icons for some common tasks for people more used to GUI.
 
   
   
   
 
" Turn off useless toolbar
I finally figured out how to remove this new feature since I also didn't see much use for it
 
   
 
set guioptions-=T
   
   
Here is for all those who haven't figured it out yet
 
   
  +
" Turn off menu bar (toggle with CTRL+F11)
   
 
set guioptions-=m
   
In your .gvimrc include the following two lines
 
   
   
  +
" Turn off right-hand scroll-bar (toggle with CTRL+F7)
   
 
set guioptions-=r
unmenu ToolBar
 
   
unmenu! ToolBar
 
   
   
  +
" CTRL+F11 to toggle the menu bar
   
  +
nmap <C-F11> :if &guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif<cr>
Doing this from an open gvim does not remove them but grays them out but doing from gvimrc does the job
 
   
   
   
  +
" CTRL+F7 to toggle the right-hand scroll bar
I was also trying to remove the menus at the top and almost succeeded with a similar technique but somehow the Buffer menu item stays there no matter what. IMHO it is a bug but it could very well be a feature ;)
 
   
  +
nmap <C-F7> :if &guioptions=~'r' \| set guioptions-=r \| else \| set guioptions+=r \| endif<cr>
   
 
I tried this
 
 
 
 
unmenu *
 
 
unmenu! *
 
 
 
 
even added this line after the above two but didn't help
 
 
unmenu Buffers
 
 
 
 
I hope this benefits you all as much as I have benefitted from all your tips
 
   
   
  +
Opera browser fans will find the bindings familiar.
 
}}
 
}}
   
 
== Comments ==
 
== Comments ==
 
<!-- parsed by vimtips.py in 0.486350 seconds-->
So how about just doing the following:
 
 
:set guioptions-=T
 
 
This causes the toolbar to not show. (This is how I have it.)
 
 
salmanhalim--AT--hotmail.com
 
, June 12, 2002 19:13
 
----
 
Similarly,
 
 
:set guioptions-=m
 
 
or -=M (more extreme solution, I think) works quite well for hiding the menus.
 
 
Perhaps a more general [http://vimplugin.sf.net/cgi-bin/help?tag={{urlencode:'guioptions'}} :help 'guioptions'] should be suggested? *grin*
 
 
salmanhalim--AT--hotmail.com
 
, June 12, 2002 19:15
 
----
 
As I posted in another thread on hiding the toolbar, this will make the toolbar/menu toggleable:
 
 
set guioptions-=T "get rid of toolbar
 
:let g:toggleTool = 0
 
map &lt;silent&gt; &lt;S-F1&gt; :if g:toggleTool == 1&lt;CR&gt;:set guioptions-=T&lt;CR&gt;:let g:toggleTool = 0&lt;CR&gt;:else&lt;CR&gt;:set guioptions+=T&lt;CR&gt;:let g:toggleTool = 1&lt;CR&gt;:endif&lt;CR&gt;
 
"
 
set guioptions-=m "get rid of menu
 
:let g:toggleMenu = 0
 
map &lt;silent&gt; &lt;S-F2&gt; :if g:toggleMenu == 1&lt;CR&gt;:set guioptions-=m&lt;CR&gt;:let g:toggleMenu = 0&lt;CR&gt;:else&lt;CR&gt;:set guioptions+=m&lt;CR&gt;:let g:toggleMenu = 1&lt;CR&gt;:endif&lt;CR&gt;
 
 
Tom Kimpton
 
 
tomk--AT--emcity.net
 
, July 29, 2002 13:19
 
----
 
Just wanted to add that removing the toolbars and the menu improves responsiveness when using gvim under X11 over a remote connection. For some reason certain operations (like say :diffupdate) causes the X11 server to spend huge amounts of time refreshing the toolbars and the menus over a remote connection.
 
 
emailgopi--AT--n0spam.netscape.net
 
, August 27, 2003 8:10
 
----
 
I found that toggling the menubar using Tom's script (above) ate up one line each time (using Andale Mono font). Below is a modified version of that script which adjusts the number of lines displayed as the menubar and toolbar are toggled, keeping the GVim window at a more uniform size.
 
 
 
" get rid of menu
 
set guioptions-=m
 
:let g:toggleMenu = 0
 
map &lt;silent&gt; &lt;S-F1&gt; :if g:toggleMenu == 1&lt;CR&gt;:set guioptions-=m&lt;CR&gt;:set lines+=1&lt;CR&gt;:let g:toggleMenu = 0&lt;CR&gt;:else&lt;CR&gt;:set guioptions+=m&lt;CR&gt;:let g:toggleMenu = 1&lt;CR&gt;:endif&lt;CR&gt;
 
 
" get rid of toolbar
 
set guioptions-=T
 
:let g:toggleTool = 0
 
map &lt;silent&gt; &lt;S-F2&gt; :if g:toggleTool == 1&lt;CR&gt;:set guioptions-=T&lt;CR&gt;:set lines+=3&lt;CR&gt;:let g:toggleTool = 0&lt;CR&gt;:else&lt;CR&gt;:set lines-=3&lt;CR&gt;:set guioptions+=T&lt;CR&gt;:let g:toggleTool = 1&lt;CR&gt;:endif&lt;CR&gt;
 
 
hashstat at eudoramail dot com
 
, October 29, 2003 7:43
 
----
 
I added this to your very usefull commands (not sure if the setlines are usefull...):
 
to show or hide the tabs
 
 
" open all buffer in tabs/close all tabs
 
:let g:toggleTabs = 0
 
map &lt;S-F3&gt; :tab ball&lt;CR&gt;
 
map &lt;silent&gt;&lt;S-F3&gt; :if g:toggleTabs == 1&lt;CR&gt;:tabo&lt;CR&gt;:set lines+=3&lt;CR&gt;:let g:toggleTabs = 0&lt;CR&gt;:else&lt;CR&gt;:set lines-=3&lt;CR&gt;:tab ball&lt;CR&gt;:let g:toggleTabs = 1&lt;CR&gt;:endif&lt;CR&gt;
 
 
 
 
'''Anonymous'''
 
, August 24, 2006 1:40
 
----
 
<!-- parsed by vimtips.py in 0.539560 seconds-->
 

Revision as of 14:17, 31 May 2007

Previous TipNext Tip

Tip: #665 - Hide toolbar or menus to see more text

Created: February 27, 2004 13:17 Complexity: basic Author: D. Bron Version: 5.7 Karma: 26/14 Imported from: Tip#665

If you like your GUI clean, but want the option to access all its power, then you might like this tip.


The variable "guioptions" determines what GUI widgets are visible (see :help guioptions). I personally prefer to have as few widgets visible as possible, until I need them. To that end, I have the following in my vimrc (thanks to Tim Chase):


" Turn off useless toolbar

set guioptions-=T


" Turn off menu bar (toggle with CTRL+F11)

set guioptions-=m


" Turn off right-hand scroll-bar (toggle with CTRL+F7)

set guioptions-=r


" CTRL+F11 to toggle the menu bar

nmap <C-F11> :if &guioptions=~'m' \

Comments