[TxMt] Overloading the tab key

Rob McBroom textmate at skurfer.com
Thu Apr 5 16:35:57 UTC 2007


On Apr 5, 2007, at 9:49 AM, Steve King wrote:

> 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.

I'm thinking you should set TextMate to use "Soft Tabs" with 8 spaces  
and then use some Snippet or Command trickery to make it insert an  
actual Tab when you hit the ⇥ key from the beginning of a line.

There doesn't seem to be a way to set "beginning of a line" as a Tab  
Trigger, but perhaps you could modify the relevant language grammars  
to have a "beginning of line" scope or an "empty line" scope and have  
a Snippet or Command with a Key Equivalent of ⇥ that inserts a  
literal Tab only in that scope.

I say "Snippet or Command" because I'm not sure which is best here.  
When Snippets containing actual Tabs are used, the Tabs are usually  
replaced according to your preferences. There may be a way to escape  
the Tab, or some hidden XML property that can be manually added to  
the Snippet to prevent this behavior. Otherwise, you might need a  
Command.

---
Rob McBroom
<http://www.skurfer.com/>
I didn't "switch" to Apple... my OS did.





More information about the textmate mailing list