First, create the icon. In the example below I use Gimp.
Start Gimp. From File menu press New. Create an 18x18 pixels bitmap.
Draw the icon. In my example I draw “B->U” (from “Betacode” to “Unicode”) as shown in the image.
You must save the icon (or “button”) with the extension bmp in Gimp. The image used in Vim must be a bitmap.
Under GNU/Linux, in your home there is a directory called .vim (the name starts with a dot). This is the VIMHOME. If there is no such directory you should create it.
Under Windows you should look for a directory called vimfiles. See my LATEX Guide, section 1.2.1.3.2 for vimfiles and other specific problems of the use of Vim under Windows.
You need three directories from VIMHOME: bitmaps, plugin and scripts. The bitmaps and plugin are standard Vim folders. Do not change their names! The folder scripts is a custom folder.
I have put the bitmap created according to the above ■ description in the bitmaps folder. I have named it b2u.bmp; you should remember the name of the image.
In the scripts folder I have put a script for converting Betacode into Unicode. In the example below, I am going to use this vim script.
For the addition of the b2u.bmp image to the Vim toolbar we have to write a vim script and place it into the plugin folder in VIMHOME. I hace named my plugin zToolBar.vim; the extension is important, but you may choose any basename you like. The content of the script is shown in the “Vim script” figure.
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,
<Esc>:source ~/.vim/scripts/beta2unicode.vim<CR>
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. <CR> is the equivalent of pressing the Enter key.
The button on the toolbar is working in the insert mode of Vim. In the “Betacode” figure we see how we write a word in the betacode transcription.
When you press the newly created button the text is converted from Betacode to Unicode.
Now we can copy and paste the Greek text in another file.