Vim Tips Wiki
(Undo revision 37629 by 198.203.28.43 (talk) -=x is the correct way to remove flag x without affecting the other flags)
 
(10 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{merged|89}}
 
 
{{TipImported
 
{{TipImported
|id=420
+
|id=89
|previous=419
+
|previous=88
|next=425
+
|next=90
|created=February 10, 2003
+
|created=2001
 
|complexity=basic
 
|complexity=basic
|author=garbageman
+
|author=Leif Wickland
 
|version=6.0
 
|version=6.0
|rating=47/38
+
|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 also get annoyed by the menu bar and/or tool bar in the gui version of vim, you can get rid
 
of them with the following:
 
   
  +
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.
  +
  +
==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 " to get rid of the menu bar
+
:set guioptions-=m "remove menu bar
 
:set guioptions-=T "remove toolbar
set go-=T " to get rid of the tool bar
 
 
:set guioptions-=r "remove right-hand scroll bar
  +
:set guioptions-=L "remove left-hand scroll bar
 
</pre>
 
</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>):
and then you're back to the look and feel of how vim should always be.
 
  +
<pre>
  +
: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):
==Comments==
 
  +
<pre>
Of course you can also put them back with
 
 
:set guioptions-=M
  +
</pre>
   
  +
==Toggling the display of a widget==
set guioptions += ...
 
  +
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.
  +
<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==
----
 
  +
You can hide some of the default gvim ToolBar buttons by adding lines like the following to your [[vimrc]]:
[[VimTip89]] was also on this very subject. I also prefer to have more screen real estate, but, sometimes want the menus handy, so, to reiterate what I posted to that tip, here are some function keys to toggle the menu and tool bars:
 
  +
<pre>
  +
aunmenu ToolBar.FindNext
  +
aunmenu ToolBar.FindPrev
  +
</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.
  +
  +
==References==
  +
*{{help|'guioptions'}}
  +
 
==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>
 
<pre>
  +
:set wildmenu
set guioptions-=T "get rid of toolbar
 
  +
:aunmenu ToolBar.<Tab>
:let g:toggleTool = 0
 
map <silent> <F2> :if g:toggleTool == 1<CR>:set guioptions-=T<CR>:let g:toggleTool = 0<CR>:else<CR>:set guioptions+=T<CR>:let g:toggleTool = 1<CR>:endif<CR>
 
"
 
set guioptions-=m "get rid of menu
 
:let g:toggleMenu = 0
 
map <silent> <F1> :if g:toggleMenu == 1<CR>:set guioptions-=m<CR>:let g:toggleMenu = 0<CR>:else<CR>:set guioptions+=m<CR>:let g:toggleMenu = 1<CR>:endif<CR>
 
 
</pre>
 
</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.