Replying with code snippets via GMail, tab-bookmarklet

I’m posting code snippets in reply to questions on one of the jQuery mailing lists a few times daily. Rather annoying is the lack of support for indentation: I have to use spaces one-by-one to indent code.

After posting about that on Twitter, Scott Gonzáles provided some good ideas and code (to access GMail’s iframes) and the result is a simple bookmarklet:

GMail Tabs

Currently it loads jQuery, the itabs plugin from the interface project and a bit of code selecting the reply-textarea within Gmail and applying the itabs plugin.

Usage: Drag above link to your bookmarks. Open GMail and click on the reply-textarea within a thread. Activate the bookmarklet and give the textarea focus again. Use the Tab key to input tabs!

There are more ideas at hand: Unindent code pasted from source files, unindent a line with shift-tab, (un)indent multiple lines (via usual text selection).

Feel free to contribute, ideas and code welcome!

Update: Now it also sets the font-family to “Courier New”, giving you a monospace font for easier visual indentation.