Making TextMate and sqlplus play nice
As described in the Calling TextMate from Other Applications chapter in the TextMate Manual
There is one command which does not support giving arguments in the EDITOR variable, it is crontab (which is sort of obsoleted by launchd). If you need to use it, you can create a symbolic link to mate with a _wait suffix which implies -w.
Well, as I found out a while ago, there’s another command that has the same problem: sqlplus. But if you follow Allan’s instructions, you can make TextMate work with sqlplus:
ln -s mate ~/bin/mate_wait # run this once to create the link
export EDITOR='mate_wait' # use in your ~/.bash_profile
Assuming you’ve already created a symlink to mate and that ~/bin exists (you could also use /usr/local/bin or some other preferred location). Now, in sqlplus simply type ed or edit as usual, and your commandline will open up in TextMate. Yay, one less reason to ever edit any text outside of TextMate.
Oracle Bundle for TextMate, Preview
After reading The Pragmatic Programmer this summer, I’ve been trying to follow some of their tips, one of them being
Tip 22: Use a Single Editor Well
Choose an editor, know it thoroughly, and use it for all editing tasks.
My editor of choice is TextMate, one of the very first applications I bought for my Mac. I’ve been using it more and more lately, but unfortunately there’s no support for working with Oracle databases. The supplied SQL bundle works only with MySQL and Postgres, and Google wasn’t any help in finding a bundle specifically for Oracle.
After spending a few hours looking into what these TextMate bundles are, it turns out they’re very, very nifty and it’s not all that difficult to create your own. So, without tiring you with more chatter, I present my first TextMate bundle, the Oracle Bundle.
I could possibly have added Oracle functionality to the existing SQL bundle, but there didn’t seem to be a lot of overlap between MySQL/Postgres and Oracle in terms of the code implementing the bundles, so I decided to create a standalone bundle. So far, it’s only got a few basic features, but I’m hoping to add more as time allows for it. The syntax just piggybacks on the SQL syntax from the SQL bundle, and I haven’t added any support for PL/SQL.
This “preview” has the following commands:
Go ahead and grab your copy here.