Option + Drag + Quote

Yet another reason I love TextMate:


You may or may not know that when you have text selected in TextMate and you press the quotation mark it will surround the selection with quotation marks (instead of replacing the selection with a single quotation mark).


Also, you may or may not know that you can select an arbitrary rectangle of text in your code by option-click-dragging across multiple rows/columns.  Then anything you type replaces what you’ve selected on every line.


Putting these two features of TextMate together, if you have option-selected some text on multiple lines, and some of the lines have trailing space selected, then you press quotation mark, it does the Right Thing by placing the quotation mark before the trailing space on each line, as opposed to at the end of the selection on every line.  Very cool.


OK, it doesn’t read very well, so try it out yourself to find out what I’m talking about.  In the case where I was copying data from a spreadsheet into my Ruby code and needed to quote the values that I copied in, it was a huge time saver.

Leave a Reply