TextMate Pt.2: Snippets Cont. Mirroring

Another handy TextMate Snippets feature is mirroring. One use for this would be if you wanted to make a header where the text displayed is the header’s id name.

Example seen here:
Picture

This is created simple by evoking this snippet:

< h1 id="$1">$1< /h1>

(Had to add spaces in tags.)

For me since the activation string is “h1″, all I had to type was “h1 (hit)Tab hello”. It automatically knows to hello is both places.

Basically you just make the Tab Stop #s the same, ie $1 in two different places will have the same text, as will $3 and another $3.


 
 

Post a comment to "TextMate Pt.2: Snippets Cont. Mirroring"