[TxMt] <? $0 ?> autocomplete
Allan Odgaard
allan at macromates.com
Sun Aug 28 12:29:40 UTC 2005
On 28/08/2005, at 13.09, Douglas Livingstone wrote:
> Whereabouts does the autocomplete for '<' (which inserts a '>') live?
This is smart-typing, which is setup for HTML in the Miscellaneous
preferences item (bundle editor).
It only works with single character pairs though.
> I'm trying to extend it to autocomplete to <? ?> and <% %>. Example,
> [...]
> Any ideas?
What you can do is, create a snippet e.g. like this: ?php $0 ?
This is what I presume you want inserted when you press ? (after
having typed <). So you set the key equivalent of that snippet to ?,
but since you only want it after <, you set the scope to:
invalid.illegal.incomplete.html (that's how the <> thing is currently
scoped, you can verify this by placing the caret on the pair and (in
b16) press ctrl-shift T (to see the exact scope)).
Then when you press ? with the caret inside <>, it'll insert the
snippet above. You can do similar for % (here the snippet would be %
$0 % or maybe just %$0%).
And starting from b17 (I'll most likely release this in 2-3 days),
placeholders can be nested, so the php snippet from above can instead
be: ?${1:php $0 }? -- this means after pressing ?, the "php " part
is selected, and you can overwrite it (e.g. with =), or you can press
tab again to get to the inner tab stop (but as mentioned, this is b17).
More information about the textmate
mailing list