Friday, October 09, 2009

TextMate Snow Leopard and

During my previous post I needed to copy RTF from a text-editor for code snippets for this blog. XCode does this by default and so does Eclipse. But TextMate does not. Google told me that this should do the trick. It's a bundle for TextMate called 'Copy as RTF' by Dr Nic Williams. I found numerous people praising this little plugin so I decided to downloaded it.

If you don't install it by using GIT, as the instructions say, you can simply download it from the above site and once un-tar'd change the name of the folder (something like 'drnic-copy-as-rtf-tmbundle-e490dbf') to 'Copy as RTF.tmbundle'. Then copy this to ~/Library/Application\ Support/TextMate/Bundles. If the bundles directory is not there then simply create it and then copy.

If TextMate is already running then click 'Bundles -> Bundle Editor -> Reload Bundles' to reload the bundles. It should work from here. I had an issue where it wasn't doing anything. I was able to track down the issue by altering the output of the bundle to get the exception. I'm by no means a TextMate expert I just happened to stumble across this. I went to 'Bundles -> Bundle Editor -> Show Bundle Editor' expanded the 'Copy as RTF' and selected the node. Then on the right pane changed the 'Output' drop-down from 'Discard' to 'Show as HTML'.





I was getting a Ruby deprecation warning and an exception about a corrupt theme. I didn't have any themes installed though. I looked through the Ruby code for the plugin where that error message was and found that it was looping through my non-existent 'Themes' folder. I downloaded a random theme and installed it and after that the exception went away and I can now get RTF output for any language in TextMate.

No comments: