EDIT: 2 & 3 actually have solutions, so it's really just #1, which is over on userecho, go vote for it now! http://sublimetext.userecho.com/topic/6 ... s-removed/
I.
The one issue I run into is that sometimes I'll nest one placeholder in another in order to make a section optional. An example being:
- Code: Select all
function ${1: name} (${2:"${3:Some Text}"})
{
${4:#Some Code}
}
(Note: Isn't tested, just an example; and to clarify in this example #2 is the optional argument)
Now, this works great until I decide to backspace on the second placeholder (so as to get rid of the optional argument), when I tab, it still highlights the third placeholder, so then I need to tab again to get to the fourth.
It would be really nice if it realized the third placeholder didn't exist anymore, and just skip it.
II.
The second thing I'd like to see is the ability to specify the endpoint of a snippet. So when you tab for the last time instead of going to the outside of the snippet, the pointer would go there. In the above example the fourth placeholder is technically the end, so when I finish tabbing it should just go there. So I'd like to have a little special character, like #, that would be hit after the last placeholder was tabbed from.
So the above example would be:
- Code: Select all
function ${1: name} (${2:"${3:Some Text}"})
{
${#:#Some Code}
}
It always bothers me to write a hundred lines of code while still filling in a snippet.
EDIT: Solved
There actually is a command for this, it's 0:
- Code: Select all
function ${1: name} (${2:"${3:Some Text}"})
{
${0:#Some Code}
}
III.
And the third thing I'd like to see is sections of the snippet that are only shown while the snippet is being created (help sections if you will).
An example with wordpress I ran into would be:
- Code: Select all
get_template_part('${1:slug}', '${2:name}'); //slug-name.php
The comment '//slug-name.php' is only needed while I'm creating the snippet (it helps me remember what goes where), but I don't want it cluttering up my code after. So I'd like something like / that denotes that section should be deleted after the snippet is done being created.
- Code: Select all
get_template_part('${1:slug}', '${2:name}'); ${/://slug-name.php}
EDIT
There is actually a trick using (I think) look backward regexs (info about it here: http://www.regular-expressions.info/lookaround.html, I believe the syntax they use is ?<=, but I'm not sure), an example:
- Code: Select all
${1:something}${1/(^something$)|.*/?1: # some comment or something/}
This is also great for multichoice:
- Code: Select all
${1} = ${1/(a$)|(b$)|(c$)|.*/?1:Apple:?2:Bannana:?3:Carrot/}
Thoughts, comments, constructive criticisms?