[TxMt] Re: Math snippet is broken in TM 2 (Latex bundle)

Allan Odgaard mailinglist at textmate.org
Fri Feb 8 08:33:57 UTC 2013


On Feb 7, 2013, at 11:01 PM, Jenny Harrison <profharrison at gmail.com> wrote:

> […] Here it is:  
> 
> \\( $0$TM_SELECTED_TEXT \\)
> 
> Scope Selector: text.tex.latex
> 
> Key equivalent: $
> 
> In TM 1,  the $ key outputs \(  $0$TM_SELECTED_TEXT \).  The curser is inside the math formula brackets \( \).  It stays inside, regardless of what I write, until I type $ again.  Then the cursor moves outside.  That is just what I want it to do.

The “step two” of having ‘$’ inside the math brackets jump outside is likely done by a macro bound to ‘$’ and scoped to ‘string.other.math.latex’ because the snippet alone would not be able to do two different things depending on context.

You can however change it to something like:

    \\( ${1:$TM_SELECTED_TEXT} \\)

This will allow you to use tab to “jump out”. Additionally it will keep the selected text selected (don’t know if you would consider that a feature or not).

You can also improve the scope selector to: text.tex.latex - string.other.math

That way its key equivalent will not fire when already inside a math string (you can also try this scope selector change alone, at least then you won’t get the snippet inserted again).

> If I erase the snippet, then in both TM 1 and TM 2,  the same thing happens.  Inputting $ the first time yields  $ $0$TM_SELECTED_TEXT $.  The second time,  the cursor moves outside.  This would be fine, except that many of us have moved away from using $ signs to set off equations in Latex.     

It does sound like you have a custom “jump out” function bound to ‘$’. You can use Bundles → Select Bundle Item… then switch to “All Scopes” and “Key Equivalent”. Now press ‘$’ to see a list of everything bound to that key. Although it’s really 1.x where you want to perform this search (which doesn’t have the “All Scopes” option, but you can open up the window while the caret is inside math brackets, and it should search that scope).



More information about the textmate mailing list