Mid-Snippet Placeholder Tab cancelling/escaping/forgetting

Jake Wilson 9 years ago 0

When using a snippet that has placeholders in it, while in the snippet you TAB from one placeholder to the next.

It's great, except most of the time when working with a snippet, while I am mid way through the snippet, it's more efficient for me to manually move to a different part of the snippet and start typing something else.  But the next time I press TAB, my cursor jumps to the next placeholder after the last placeholder I was at before I moved elsewhere manually.

It would be very nice that if the user used any navigation keys (arrow keys, home, end, page up, page down, etc) while mid-snippet, that Sublime would "cancel" out of the "snippet TAB mode".  So after moving elsewhere, pressing TAB no longer moved you to the next snippet placeholder.  Sort of like, once you move elsewhere mid-snippet, it would be nice if SublimeText2 would "forget" that you were in a snippet.  So the next tab was treated like a normal tab instead of a key that moved you back to the next snippet placeholder.

In most cases (at least for me), when moving elsewhere during the snippet, that basically means that I'm done with the snippet and I need to continue to something else.  I don't want to press TAB and be moved BACK into the snippet again.

Another place this is extremely useful is using snippets within snippets.  Take the following HTML snippet:









After typing "table" and pressing TAB, it creates the snippet and moves your cursor to $1.  Then, lets say you have a <td>$1<td> snippet you want to use next.  If you type "td" and press TAB, then it doesn't create the TD snippet for you.  Instead it types "td" and then moves you to $2 in the above snippet.

It would be great if SublimeText2 would detect that if a snippet tabTrigger was typed while within a Snippet, then the first Snippet was forgotten and it would now work with the new snippet you just typed.

This sounds pretty confusing. I hope it makes sense...