+3
Completed

Execute a snippet within a snippet

Remy Bach 6 years ago • updated by Jon Skinner 6 years ago 3
It would be really cool to be able to run a snippet without having to tab out of the currently executing one (and then return where you left off with tabbing through the original snippet).

Answer

Answer
Completed
You can do this using ctrl+space
Answer
Completed
You can do this using ctrl+space
Is there any way this could be done with a normal tab? Ctrl+Space is the default binding for application launchers such as Google Quick Search Box (on mac), Synapse (Linux), or Colibri (Windows).

I've tried rebinding the ctrl+space command to be tab, but that messes up the original tab functionality (as you probably would've known it would do).

Thank you for the quick response by the way!
Ctrl+Space is the key binding for auto complete in Sublime Text 2 (and in many other applications), although there's nothing stopping you from rebinding it to something else.

It's not possible to use tab for inserting a snippet within a snippet, as it's used for moving between the fields, and there would be no way to determine if a user wanted to move to the next field or complete the current word.
+4
I think you're possibly misunderstanding me... I'm not talking about auto-complete, I mean just for snippets.

For example, if I had two custom snippets as follows:

php->tab = <?php $1 ?>$0
if->tab = if ($1) { $0 }

... I'd want to be able to do php->tab, then immediately do if->tab and step through the if snippet and when it reached the last tab stop in the if snippet, have it resume where it was in the php snippet. Hope that makes sense!?

ps: I had a go at the new Textmate 2 Alpha and it doesn't even come close to convincing me to move back to it from Sublime. You're doing an amazing job!