Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to remove some of the default icons and maybe add one or two icons of my own. For example, it would be nice if there were icons for the NerdTree and the Taglist.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Ludwig's answer got me started, but it was not really the kind of answer I hoped for. So I made the question community-wiki and leave this answer with what I found out. The answer will be improved as I go along.

Find out what the toolbar currently consists of

:tmenu ToolBar

This will give you a listing of the commands currently on your toolbar. It will list the position, name and tooltip for each entry.

Delete something from the default toolbar

You can use your .gvimrc to delete entries from your default toolbar. For example, to get rid of the make command:

:aunmenu ToolBar.Make

You need to specify the menu ("ToolBar") and the name of the command ("Make").

Add a new entry to your toolbar

To add a new command to the toolbar, use the tmenu and amenu command. For example, the following commands will add an icon that will toggle the display of the taglist (of course, you need to install the taglist plugin first):

:tmenu ToolBar.taglist Toggle display of the Taglist
:amenu ToolBar.taglist :TlistToggle<CR>

Again, you need to specify the name of the menu ("ToolBar") and the name of your new menu entry ("taglist"). The name of the new entry will also be used to search for an icon. You can place the icon in your ~/.vim/bitmaps/ directory (simply create it if it doesn't exist yet). Supposedly, you need a .bmp on Windows and a .xpm everywhere else. The icon's size needs to be 18 x 18 pixels.

tmenu is responsible for the tooltip displayed when hovering the icon. Use amenu to decide what should happen when the icon is clicked.

share|improve this answer
3  
Because I didn't know the answer when I posted the question. Just read my answer and you'll know. –  innaM Aug 11 '09 at 12:09
    
Just to add, you can create a menu entry by replacing ToolBar with your own menu title. –  TiCL Sep 24 '11 at 6:17

I found this tutorial helpful. The most interesting part is quoted below:

:tmenu 1.190 ToolBar.b2u beta2unicode
:imenu ToolBar.b2u <Esc>:source ~/.vim/scripts/beta2unicode<CR>

In the first line 1.190 indicates a position on the toolbar. In ToolBar.b2u “b2u” is the name of the image (without the bmp extension). The last item on the first line is a short description of the action associated with the icon (or button, as you want to call it) on the toolbar.

In the second line, ToolBar.b2u follows the same logic as on in the first line. The last part,

:source ~/.vim/scripts/beta2unicode.vim

starts with a change of the Vim mode to the command line mode. The command is to “source” (to interpret and execute) the script. The VIMHOME here is ~/.vim/. The folder in the VIMHOME is scripts| and \verb|beta2unicode.vim is the name of the script. is the equivalent of pressing the Enter key.

It basically works like adding other menus. You can find the details in vim's help (:help menu).

share|improve this answer
    
That's a start, but not really a good one. This tutorial only works on Windows and it explains almost nothing. However, it gave me some more keywords for Googling. –  innaM Jul 23 '09 at 16:26
    
@Manni: Hmm, it should be enough to get you started, after that it is IMHO best to stick to vim help anyway. For the 'only works on Windows' part: Can you explain what didn't work for you? –  Ludwig Weinzierl Jul 23 '09 at 16:55
    
The tutorial tells you to create icons in .bmp format. On everything that is not Windows, you need .xpm. –  innaM Jul 23 '09 at 18:21
    
Don't get me wrong though. This really got me started. I just hope that there is something a little better out there. –  innaM Jul 23 '09 at 18:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.