[TxMt] Conditional insertion help

Allan Odgaard throw-away-1 at macromates.com
Mon Sep 18 17:52:15 UTC 2006


On 18/9/2006, at 15:36, guerom00 wrote:

> [...] What I would like to do is, in the “allocatable” or  
> “dimension” case, that the caret goes between the braces after I  
> type in the name. In the snippet definition, that would be to  
> somehow define a $4 key but I really don't know how to do this...

This is not possible (but something I would like to allow later).

The printf snippet in the C bundle tries to fake it by having an  
extra tab stop, and then conditionally inserts ‘(’ to the left of it,  
and ‘)’ to the right (well, it actually uses other characters, but in  
this case it would).

For an example, switch to C, then type ‘printf’ followed by tab. Now  
if you delete the %s text, the argument placeholder disappears, and  
tabbing goes after the ‘)’, if however you keep it, or later write  
another %-sequences, the argument placeholder appears again, and  
tabbing goes to right before the ‘)’.







More information about the textmate mailing list