[TxMt] snippet to generate unique ID, detect end of document, and move cursor

Stephan Hugel urschrei at gmail.com
Sun Jul 25 22:20:45 UTC 2010


Hello,
I'm trying to write a snippet that will create a footnote in a TM file
(using markdown syntax), and I'm having some difficulties:
Footnote syntax works as follows:
Here's a string of text [^footnote_identifier] which continues here.

then, at the beginning of a new line:
[^footnote_identifier]: text of the footnote itself

So, what the snippet needs to do (theoretically) when snippet is
triggered: generate a (not too long, 5 digit alphanumeric should be
fine for a single document) unique id, and insert the full
[^footnote_identifier] string, then jump to the end of the document,
insert [^footnote_identifier]: and a space, allow typing of the
footnote text, then return to the original insertion point when tab is
pressed again.

I have no idea whether any of this is possible using snippet syntax,
so any pointers would be appreciated.


-- 

steph



More information about the textmate mailing list