TextMate addi(c)tions

Manfred Stienstra

For the last few months I’ve been using TextMate on my iBook and on the Lil’ Mac at work. I’ve grown accustomed to the various ‘insert snippet’ commands available in TextMate. Unfortunately Vim doesn’t have these commands and I find myself inserting ^Z in my views.

However, Vim configuration is powerful enough to implement these commands. Make sure you’re in command mode and do the following:

:imap <C-z> <lt>%=  %><Left><Left><Left>
:imap <C-x> <lt>%  %><Left><Left><Left>

This will allow you to insert <%= %> and <% %> into your files during insert mode. It is also possible to insert these commands in ~/.vimrc so you don’t have to define them every time you launch vim.

You can find the other mapping syntax rules on the vim.org website and in your vim help files.


You’re reading an archived weblog post that was originally published on our website.