I've discovered that the person hogging my usual username on Blogger was in fact me and so after rooting around the back corners of my memory I produced a password and decided to use this fantastic free service to start up a development blog about my Vim plugin: snippetsEmu
The script has been through several iterations so I'll use this first post to record its history.
My initial encounter with the OS X editor TextMate
was (no doubt like a lot of people) through the magical Rails videos
. Not to distract from the DSL goodness of Rails but one reason it looked so damn easy to use was the fantastical editor used to construct the beautiful code. Sadly I had given away my iMac as I was moving houses too often (a very generous gift for my brother) and so could not join in the fun.
Thankfully my work required that I make regular use of the One True Editor
and I had just discovered its built in scripting functionality. Being a fan of Python
and having started on the long, dark journey towards mastery of Word macros, the lure of some new scripting treasure was too great and so I set out to make for myself that which others already had.
Not one to stand on the shoulders of giants (and too lazy to thoroughly Google about) I set about replicating the TextMate functionality from scratch. My initial attempt used the builtin iabbr command to add a load of @'s into the buffer and some simple searches to jump around between them. Pleased with this I promptly documented it on the Rails wiki, where it still stands
To be honest, this initial attempt was crap. Had I discovered the imaps plugin for Vim then I no doubt would have used that instead and been happy. But thankfully I discovered the MacroMates post
on the power of snippets which showed me just what extra work was required. An initial release soon followed which added variable replacement. A couple of weeks later, based on a suggestion from Salman I added a new version which allowed users to define their own start and end tags. I also added in the idea of default values. I never really liked this idea as I personally used the tag's name as a default value but, ever eager to please, I added it in.
A few bug fixes later I uploaded version 0.3. This added the idea of command execution. A couple more bug releases and a change in the way commands were defined and development slowed up.
Six months later I uploaded version 0.5. I'd seen a bit more of TextMate in action and I'd changed some of my ideas about how things should work. Default values were removed (these make sense in TextMate but only because the tags used there are not displayed on screen) and the new TextMate compatibility mode was added. Snippets no longer expand by default; the user is required to hit Tab before the magic happens. More bug fixes and we're up to date.