No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{review}} |
{{review}} |
||
{{Tip |
{{Tip |
||
− | |id= |
+ | |id=665 |
− | |title= |
+ | |title=Hide & Toggle GUI widgets |
− | |created= |
+ | |created=February 27, 2004 13:17 |
|complexity=basic |
|complexity=basic |
||
− | |author= |
+ | |author=D. Bron |
− | |version= |
+ | |version=5.7 |
− | |rating= |
+ | |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. |
||
⚫ | |||
− | I finally figured out how to remove this new feature since I also didn't see much use for it |
||
⚫ | |||
− | Here is for all those who haven't figured it out yet |
||
+ | " Turn off menu bar (toggle with CTRL+F11) |
||
⚫ | |||
− | In your .gvimrc include the following two lines |
||
+ | " Turn off right-hand scroll-bar (toggle with CTRL+F7) |
||
⚫ | |||
− | 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 == |
||
⚫ | |||
− | So how about just doing the following: |
||
− | |||
⚫ | |||
− | |||
− | 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 <silent> <S-F1> :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> <S-F2> :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> |
||
− | |||
− | 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 |
||
⚫ | |||
− | :let g:toggleMenu = 0 |
||
− | map <silent> <S-F1> :if g:toggleMenu == 1<CR>:set guioptions-=m<CR>:set lines+=1<CR>:let g:toggleMenu = 0<CR>:else<CR>:set guioptions+=m<CR>:let g:toggleMenu = 1<CR>:endif<CR> |
||
− | |||
⚫ | |||
⚫ | |||
− | :let g:toggleTool = 0 |
||
− | map <silent> <S-F2> :if g:toggleTool == 1<CR>:set guioptions-=T<CR>:set lines+=3<CR>:let g:toggleTool = 0<CR>:else<CR>:set lines-=3<CR>:set guioptions+=T<CR>:let g:toggleTool = 1<CR>:endif<CR> |
||
− | |||
− | 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 <S-F3> :tab ball<CR> |
||
− | map <silent><S-F3> :if g:toggleTabs == 1<CR>:tabo<CR>:set lines+=3<CR>:let g:toggleTabs = 0<CR>:else<CR>:set lines-=3<CR>:tab ball<CR>:let g:toggleTabs = 1<CR>:endif<CR> |
||
− | |||
− | |||
− | |||
− | '''Anonymous''' |
||
− | , August 24, 2006 1:40 |
||
− | ---- |
||
⚫ |
Revision as of 14:17, 31 May 2007
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' \