[TxMt] Text width control

Allan Odgaard throw-away-1 at macromates.com
Fri Mar 24 15:02:55 UTC 2006


On 24/3/2006, at 15:49, Afternoon wrote:

> Thanks David, that's quite handy.
>
> I guess this is going to be a plugin thing. Better brush up my  
> Objective C in time...

Currently it’s not really possible to do as a plug-in.

What you could do was create a command, let that command do something  
like:

    if [[ $TM_COLUMN_NUMBER -gt 78 ]]
      then echo -ne '\n\t\t'
      else echo -ne ' '
    fi

Then set the key equivalent of this command to space, set the input  
to “none” and output to “insert as snippet”.

Then when you press space, and you are at a column position higher  
than 78, it will insert a newline and two tabs.

You can even customize this command for different scopes using the  
scope selector, e.g. in comments you can have it also insert the  
comment character on the new line, and similar for strings.




More information about the textmate mailing list