Hi all,
Whereabouts does the autocomplete for '<' (which inserts a '>') live?
I'm trying to extend it to autocomplete to <? ?> and <% %>. Example,
I type this:
<?php |
Currently I get this:
<?php |>
I'd like to get this:
<?php | ?>
Any ideas?
Thanks, Douglas
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).
On 8/28/05, Allan Odgaard allan@macromates.com wrote:
On 28/08/2005, at 13.09, Douglas Livingstone wrote:
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 <
That's magic, thanks Allan.
I was having a go at setting the input pattern to <?php, though was having no luck. Now it's perfect!
Cheers, Douglas