Vim Tips Wiki
Register
(Move categories to tip template)
(Undo revision 37629 by 198.203.28.43 (talk) -=x is the correct way to remove flag x without affecting the other flags)
 
(26 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{review}}
 
 
{{TipImported
 
{{TipImported
|id=665
+
|id=89
|previous=663
+
|previous=88
|next=667
+
|next=90
|created=February 27, 2004
+
|created=2001
 
|complexity=basic
 
|complexity=basic
|author=D. Bron
+
|author=Leif Wickland
|version=5.7
+
|version=6.0
|rating=26/14
+
|rating=67/39
|category1=
+
|category1=Options
 
|category2=
 
|category2=
 
}}
 
}}
  +
In gvim, the <code>'guioptions'</code> setting controls whether various GUI widgets are shown (and more). For example, you can choose whether to hide or show the menu bar, toolbar or scroll bar.
If you like your GUI clean, but want the option to access all its power, then you might like this tip.
 
   
  +
This tip shows how to control whether these widgets are displayed. Removing the widgets provides more space to see your text, and can speed up screen updates when using X11 over a remote connection. It is also possible to [[#Hiding buttons on the toolbar|hide specific menus or buttons]] rather than the entire GUI widget if you just want to simplify the contents of the widget.
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:
 
   
  +
==Removing a widget==
  +
If you do not want to see a widget, put whichever of the following you like in your [[vimrc]]:
 
<pre>
 
<pre>
 
:set guioptions-=m "remove menu bar
" Turn off useless toolbar
 
set guioptions-=T
+
:set guioptions-=T "remove toolbar
 
:set guioptions-=r "remove right-hand scroll bar
  +
:set guioptions-=L "remove left-hand scroll bar
  +
</pre>
   
  +
While using gvim, you can easily display a widget. For example, enter the following command to display the menu bar (<code>'go'</code> is an abbreviation for <code>'guioptions'</code>):
" Turn off menu bar (toggle with CTRL+F11)
 
  +
<pre>
set guioptions-=m
 
  +
:set go+=m
  +
</pre>
   
  +
A more extreme version of removing the menu bar is the following, which does not source the menu script ({{help|'go-M'}} has more information):
" Turn off right-hand scroll-bar (toggle with CTRL+F7)
 
  +
<pre>
set guioptions-=r
+
:set guioptions-=M
  +
</pre>
   
  +
==Toggling the display of a widget==
" CTRL+F11 to toggle the menu bar
 
  +
The following mappings provide toggles to show or hide a widget. For example, press Ctrl-F1 to display the menu bar (if it is currently hidden), or to hide the menu bar (if it is currently displayed). Ctrl-F2 toggles the toolbar, and Ctrl-F3 toggles the right-hand scrollbar.
nmap &lt;C-F11&gt; :if &amp;guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif&lt;cr&gt;
 
  +
<pre>
  +
nnoremap <C-F1> :if &go=~#'m'<Bar>set go-=m<Bar>else<Bar>set go+=m<Bar>endif<CR>
  +
nnoremap <C-F2> :if &go=~#'T'<Bar>set go-=T<Bar>else<Bar>set go+=T<Bar>endif<CR>
  +
nnoremap <C-F3> :if &go=~#'r'<Bar>set go-=r<Bar>else<Bar>set go+=r<Bar>endif<CR>
  +
</pre>
   
  +
==Hiding buttons on the toolbar==
" CTRL+F7 to toggle the right-hand scroll bar
 
  +
You can hide some of the default gvim ToolBar buttons by adding lines like the following to your [[vimrc]]:
nmap &lt;C-F7&gt; :if &amp;guioptions=~'r' \| set guioptions-=r \| else \| set guioptions+=r \| endif&lt;cr&gt;
 
  +
<pre>
  +
aunmenu ToolBar.FindNext
  +
aunmenu ToolBar.FindPrev
 
</pre>
 
</pre>
   
  +
See {{help|builtin-tools}} for a list of available buttons. The names may be different if your language is not English. To find the actual names, type <code>:aunmenu ToolBar.</code> then press Ctrl-D.
Opera browser users will find the key bindings familiar.
 
  +
  +
==References==
  +
*{{help|'guioptions'}}
   
 
==Comments==
 
==Comments==
  +
About [[#Hiding buttons on the toolbar]] above: <code>:aunmenu ToolBar.<Ctrl-D></code> shows the button names in scrambled order. To see them in their '''actual''' order, use
  +
<pre>
  +
:set wildmenu
  +
:aunmenu ToolBar.<Tab>
  +
</pre>
  +
then <Right> <Left> to select (if you stop on a | you'll see the actual "menu separator" name on the command line), <Esc> to cancel, <Enter> to remove that toolbar button '''(Careful here)'''. --[[User:Tonymec|Tonymec]] 18:12, 8 August 2009 (UTC)
   
  +
==Related Plugins==
----
 
  +
*{{script|id=2437|text=shymenu}} ''[[Script:2437|comments]]'' Allows users to temporarily show the menu by pressing a menu's accelerator key.

Latest revision as of 03:43, 22 June 2014

Tip 89 Printable Monobook Previous Next

created 2001 · complexity basic · author Leif Wickland · version 6.0


In gvim, the 'guioptions' setting controls whether various GUI widgets are shown (and more). For example, you can choose whether to hide or show the menu bar, toolbar or scroll bar.

This tip shows how to control whether these widgets are displayed. Removing the widgets provides more space to see your text, and can speed up screen updates when using X11 over a remote connection. It is also possible to hide specific menus or buttons rather than the entire GUI widget if you just want to simplify the contents of the widget.

Removing a widget[]

If you do not want to see a widget, put whichever of the following you like in your vimrc:

:set guioptions-=m  "remove menu bar
:set guioptions-=T  "remove toolbar
:set guioptions-=r  "remove right-hand scroll bar
:set guioptions-=L  "remove left-hand scroll bar

While using gvim, you can easily display a widget. For example, enter the following command to display the menu bar ('go' is an abbreviation for 'guioptions'):

:set go+=m

A more extreme version of removing the menu bar is the following, which does not source the menu script (:help 'go-M' has more information):

:set guioptions-=M

Toggling the display of a widget[]

The following mappings provide toggles to show or hide a widget. For example, press Ctrl-F1 to display the menu bar (if it is currently hidden), or to hide the menu bar (if it is currently displayed). Ctrl-F2 toggles the toolbar, and Ctrl-F3 toggles the right-hand scrollbar.

nnoremap <C-F1> :if &go=~#'m'<Bar>set go-=m<Bar>else<Bar>set go+=m<Bar>endif<CR>
nnoremap <C-F2> :if &go=~#'T'<Bar>set go-=T<Bar>else<Bar>set go+=T<Bar>endif<CR>
nnoremap <C-F3> :if &go=~#'r'<Bar>set go-=r<Bar>else<Bar>set go+=r<Bar>endif<CR>

Hiding buttons on the toolbar[]

You can hide some of the default gvim ToolBar buttons by adding lines like the following to your vimrc:

aunmenu ToolBar.FindNext
aunmenu ToolBar.FindPrev

See :help builtin-tools for a list of available buttons. The names may be different if your language is not English. To find the actual names, type :aunmenu ToolBar. then press Ctrl-D.

References[]

Comments[]

About #Hiding buttons on the toolbar above: :aunmenu ToolBar.<Ctrl-D> shows the button names in scrambled order. To see them in their actual order, use

	:set wildmenu
	:aunmenu ToolBar.<Tab>

then <Right> <Left> to select (if you stop on a | you'll see the actual "menu separator" name on the command line), <Esc> to cancel, <Enter> to remove that toolbar button (Careful here). --Tonymec 18:12, 8 August 2009 (UTC)

Related Plugins[]

  • shymenu comments Allows users to temporarily show the menu by pressing a menu's accelerator key.