Archive for September, 2011

Diagramming Plug-In for Sublime Text 2

// September 12th, 2011 // Comments Off // Uncategorized

For those of those who have tried it, the minimalistic but powerful experience that is Sublime Text 2 is fairly nice.

One of the things that is missing (for me at least) is integration for my diagramming tools. I make pretty extensive use of PlantUML, GraphViz, and DITAA for diagrams. I have a strong belief that, while pictures are worth 1000 words, it is not always worth the trouble to draw them by hand. While Visio has sold many concepts, I like to be able to embed diagrams pervasively in my code, track their development with revision control, and ultimately be able to modify them with some powerful (invariably text-based) tool.

PlantUML has a lovely Eclipse plugin. It makes a nice little view that sits neatly next to your editor. When your selection tracks into a diagram, commented or otherwise, it dutifully renders it for you.

Sublime Text has not yet reached the point where this level of graphical integration is possible. However, you can have my diagrams when you pry them from my cold, dead hand. As a stopgap measure, I’ve written a little plugin for Sublime Text that will find diagrams that overlap your selection, render them, and them display them in a handy Quick Look menu. As you might have guessed, this is currently Mac only (though I’ll gladly accept patches). While it only supports PlantUML right now, it’s capable of being easily extended for other diagram types.

You can find it on GitHub. Or, if you prefer to just have the git URL: git://github.com/jvantuyl/sublime_diagram_plugin.git

I hope it’s helpful. To install it, you must have Java installed on your Mac. Then just check it out into ~/Library/Application Support/Sublime Text 2/Packages/Diagram (i.e. that should be the root of the checkout). Upon loading Sublime, just check your console to see that it detected the version of PlantUML as it should have. If so, you should be able to select any drawings (rather undecorated or in a comment) and press Cmd+M to render them (this shortcut is up for discussion, I just picked one that was open on my system).

I’ve only tested it on Lion, but I think it should work on Leopard and Snow Leopard as well (all it needs from MacOS is the qlmanage command).

I hope it’s helpful!