Vim Tips Wiki
Register
(Move categories to tip template)
(Move categories to tip template)
Line 1: Line 1:
 
{{review}}
 
{{review}}
 
{{TipImported
 
{{TipImported
|id=420
+
|id=665
|previous=419
+
|previous=663
|next=421
+
|next=667
|created=February 10, 2003
+
|created=February 27, 2004
 
|complexity=basic
 
|complexity=basic
|author=garbageman
+
|author=D. Bron
|version=6.0
+
|version=5.7
|rating=47/38
+
|rating=26/14
 
|category1=
 
|category1=
 
|category2=
 
|category2=
 
}}
 
}}
If you also get annoyed by the menu bar and/or tool bar in the gui version of vim, you can get rid
+
If you like your GUI clean, but want the option to access all its power, then you might like this tip.
  +
of them with the following:
 
  +
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:
   
 
<pre>
 
<pre>
  +
" Turn off useless toolbar
set guioptions-=m " to get rid of the menu bar
 
 
set guioptions-=T
set go-=T " to get rid of the tool bar
 
</pre>
 
   
  +
" Turn off menu bar (toggle with CTRL+F11)
and then you're back to the look and feel of how vim should always be.
 
 
set guioptions-=m
   
  +
" Turn off right-hand scroll-bar (toggle with CTRL+F7)
==Comments==
 
 
set guioptions-=r
Of course you can also put them back with
 
   
  +
" CTRL+F11 to toggle the menu bar
set guioptions += ...
 
  +
nmap &lt;C-F11&gt; :if &amp;guioptions=~'m' \| set guioptions-=m \| else \| set guioptions+=m \| endif&lt;cr&gt;
   
  +
" CTRL+F7 to toggle the right-hand scroll bar
----
 
  +
nmap &lt;C-F7&gt; :if &amp;guioptions=~'r' \| set guioptions-=r \| else \| set guioptions+=r \| endif&lt;cr&gt;
[[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>
 
set guioptions-=T "get rid of toolbar
 
:let g:toggleTool = 0
 
map &lt;silent&gt; &lt;F2&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;F1&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;
 
 
</pre>
 
</pre>
  +
  +
Opera browser users will find the key bindings familiar.
  +
 
==Comments==
   
 
----
 
----

Revision as of 04:07, 25 April 2008

Tip 665 Printable Monobook Previous Next

created February 27, 2004 · complexity basic · author D. Bron · version 5.7


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:

" 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' \| set guioptions-=m \| else \| set guioptions+=m \| endif<cr>

" CTRL+F7 to toggle the right-hand scroll bar
nmap <C-F7> :if &guioptions=~'r' \| set guioptions-=r \| else \| set guioptions+=r \| endif<cr>

Opera browser users will find the key bindings familiar.

Comments