I’m sure a lot of you guys absolutely love the snippets, and they are really powerful, especially with some of the more complex things like nesting.
EDIT: 2 & 3 actually have solutions, so it’s really just #1, which is over on userecho, go vote for it now! sublimetext.userecho.com/topic/6 … s-removed/
[size=150]I.[/size]
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:
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.
[size=150]II.[/size]
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:
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.
[size=150]EDIT: Solved[/size]
There actually is a command for this, it’s 0:
function ${1: name} (${2:"${3:Some Text}"})
{
${0:#Some Code}
}
[size=150]III.[/size]
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:
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.
get_template_part('${1:slug}', '${2:name}'); ${/://slug-name.php}
[size=150]EDIT[/size]
There is actually a trick using (I think) look backward regexs (info about it here: regular-expressions.info/lookaround.html, I believe the syntax they use is ?<=, but I’m not sure), an example:
${1:something}${1/(^something$)|.*/?1: # some comment or something/}
This is also great for multichoice:
${1} = ${1/(a$)|(b$)|(c$)|.*/?1:Apple:?2:Bannana:?3:Carrot/}
Thoughts, comments, constructive criticisms?