[txmt-dev] Re: Question about PlugIns

Allan Odgaard mailinglist at textmate.org
Mon Jan 28 20:24:06 UTC 2013


On Jan 28, 2013, at 8:41 PM, Caleb Land <caleb.land at gmail.com> wrote:

> […] I can type "table>tr*3>td*3" and hit ^E and it will create a table with three rows and three columns.
> 
> It works on selections or if the cursor is at the end of the Emmet expression.
> 
> How it works
> From what I can tell, when an Emmet expand action is executed, it looks at the carret position/selection and determines if the selection contains a valid expansion expression (or if the text proceeding the carret is a valid expression if there is no selection).
> 
> When the plugin is ready to perform the expansion, it tells TM to select the contents of the expansion expression, and calls `insertSnippetWithOptions` to replace the contents it with the expanded contents.

It sounds like this could be done as a regular bundle command:

    Input: Selection or Line¹
    Output: Replace Input, Format: Snippet

Am I missing something?


¹ Presently this fallback input is not exposed in TM2’s bundle editor. You need to edit the XML of the tmCommand and insert:

    <key>fallbackInput</key>
    <string>line</string>



More information about the textmate-dev mailing list