On 26/10/2005, at 21.30, Charilaos Skiadas wrote:
As it stands, the second to last brace is matched as closing the placeholder ${1, which leaves the wrong thing highlighted . The trick is to escape it, like so:
\foo${1:{${2:0},${3:0}}}
Very nifty and useful, and not documented I think.
It actually is mentioned in my blog-entry on the subject of snippets (linked to from the TextMate Help Book):
The default value can itself contain variables or shell code. If you want the default text to contain a }, you need to escape it. But all other characters are verbatim.
My first impulse was to escape the corresponding left brace as well, but it doesn't need (and in fact won't accept) escaping. No sure how I feel about that, it looks asymmetric to me. But hey, it works!
The problem is, if I accept arbitrary escapes, \ will have to be \, and these are used e.g. in regexp's (in snippets) -- not to mention regexps matching literal \ in snippets, which would then be \\ -- so for this reason, snippets use very conservative escaping.