30 Nov, 2007
TextMate tip: Making single apostrophes double
Posted by: Jure Cuhalev In: javascript|Planet Kiberpipa|Planet LiveCD|Tech
Coming from Python world where most of text is in double apostrophes like:
"Hello world"
to JavaScript where, e.g. jQuery , expects you to write:
$('#foobar')
with single quotes, it can be quite annoying to always have to type it twice, since for double quotes (“), TextMate it always does it automatically. This feature is called Auto-Paired Characters.
Here is a procedure how to extend your Auto-Paired characters to also include ‘, in the default list (or any other character for that matter).
Go to Bundle Editor, and locate Text bundle (you might have to turn it on using Filter List in bottom left corner). Now locate Text -> Miscellaneous with (p) next to it. Inside it you should see a snippet of text that says:
...
smartTypingPairs = (
( '"', '"' ),
( '(', ')' ),
( '{', '}' ),
( '[', ']' ),
( '“', 'â€' ),
( "', '" ),
);
...
edit that snippet to look like this:
...
smartTypingPairs = (
( '"', '"' ),
( '(', ')' ),
( '{', '}' ),
( '[', ']' ),
( '“', 'â€' ),
( "', '" ),
( "'", "'" ), <--- insert this line
);
...
And that’s it! Just restart TextMate for Bundle to reload and try it out by typing ‘ and observe its new auto-pairing powers.