[TxMt] Overloading the tab key

Steve King steve at narbat.com
Thu Apr 5 13:49:03 UTC 2007


I'm trying to do something a little weird and I'd like some help.  It has 
to do with tabs.

The local coding standard is to indent with hard tabs, 8 characters wide. 
So far so good.  But we want to avoid tabs within the line, after the 
first non-whitespace character.  Example:

         int foo         = 1234;         // foo
         int bar         = 5678;         // bar
         int foobar      = 12345678;     // foobar

So before the "int" there should be a hard tab, but before the "=" and 
"//" characters there should just be spaces.  I'd like to use the tab key 
for all of this (ie., <tab> i n t <space> f o o <tab> = 1 2 3 4 ...), 
changing its behavior from hard tabs to soft tabs depending on where I am 
within the line.

I wrote a command script that will actually do this and bound it to the 
tab key with Activation: Key Equivalent.  But, unfortunately stealing the 
tab key like this breaks ordinary tab triggers and tabbing between snippet 
fields.

Anyone have suggestions on how overload the tab key without losing what 
it already does?  I'd also accept some way of binding tab triggers 
and snippets to some other keystroke.

-- 
Steve King, <steve at narbat.com>



More information about the textmate mailing list