Hi,
1) I would like to create a snippet like (actually a part of a snippet)
${1:[${2:text}]}
So when I insert it on the first tab I have
[text]
with the option of deleting it typing <delete> and then on the second tab to modify the actual placeholder. The problem is when I replace the square brackets [] with curly brackets {}. I have tried a few options with mirror and conditional insertions but to no avail. Any suggestions?
2) I would like to have a snippet for LaTeX superscript (and subscript) such that curly brackets are included when the content is at least two characters and no brackets when I have only one character, that is "^{abc}" and "^a".
So far I have the following solution
^${1/(.{2,})|./(?1:{)/}$1${1/(.{2,})|./(?1:})/}$0
but there is a few problems. When I have nested superscript (or subscripts) if the nested supscript is inserted as second character, then the caret is not at the right place. So if I type
^a^
I get
^{a|^}
where | indicates the position of the caret. The second problem is that if the first command triggers a snippet of a command, the snippet no longer work.
Any suggestions?
Regards,
Guido
-- Dr Guido Governatori http://www.governatori.net http://www.governatori.net/TextMate