Sublime Forum

Tab complete PHP tags inside PHP

#1

I am in a PHP document. I type php[tab] and it expands to <?php | ?> (where | is the cursor).

With my cursor inside the PHP tags, I would like php[tab] to close and reopen the PHP tags, like this: ?>|<?php

This behavior is default in TextMate but doesn’t seem to be active in my SublimeText installation. How can I implement it?

0 Likes

#2

This occurs because of a conflict between tab' meaning "jump to the next spot in the code expansion" andtab’ meaning “use the current text to put in a new code expansion”. As far as I can tell, the built-in nature of tab completion makes it impossible to preempt the former mechanic with the latter using the tab key. You can, however, use another mapping to get to the expansion (the dropdown list completion mechanism provides expansion possibilities, and the “use best expansion” mechanism * should work as you expect `tab’ to).*

0 Likes