[TextMate] Unification of snippets, macros & commands (was: cool tip & bug)
Allan Odgaard
allan at macromates.com
Sun Oct 24 13:40:25 UTC 2004
On 24. Oct 2004, at 8:42, Eric Hsu wrote:
> 3. In some corner of my head I feel like snippets, macros and commands
> should really all be one type of automation entity. I'm not sure how
> to do that, but it's a little confusing to have so much power
> distributed across three different kinds of triggers...
I've been thinking about this myself. I also want templates, drag
commands, and upcoming "project drawer commands" to be rolled into this
unification.
In a way, a snippet could be viewed as a normal command, but with 'cat'
as the interpreter instead of 'bash' (with output set to 'insert as
snippet').
In a similar way, a macro could also just have another interpreter
(e.g. 'AppleScript' in the future).
Templates (and drag commands) already are basically just commands, and
moving them into this unification allows the former to also utilize the
snippet features (i.e. to have placeholders in the templates).
With regard to the actual trigger, the snippet trigger is basically
just a multi-stroke hotkey -- I'd like to change this to be a regular
expression instead (but with slightly changed semantics, in that it'll
always do non-greedy matching) and introduce some special codes for the
various modifier keys, then this would be a superset of both hotkeys
and snippet triggers, but allow so much more customizability, e.g. a
trigger could be: "\n}" and the command could do a shift-left (i.e. the
requested de-indent pattern).
There should be an option whether to leave the trigger in the text or
not (before executing the command).
The downside is that there may be a little more work required, i.e.
currently the '\t' after the snippet trigger is implicit, and the 'cat'
interpreter is also implicit.
I'd be interested in hearing peoples thoughts on the issue!
Kind regards Allan
More information about the textmate
mailing list