[TxMt] Overloading the tab key

Ed Singleton singletoned at gmail.com
Thu Apr 5 18:38:36 UTC 2007


On 4/5/07, Thomas Aylott (subtleGradient) <oblivious at subtlegradient.com> wrote:
>
> On Apr 5, 2007, at 12:35 PM, Rob McBroom wrote:
>
>
> 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.
>
> Or you could just make a simple snippet that insets a real tab character
>  and set it to use option-tab
> Then you just have to always remember to hit option-tab for a real tab

Or you could just overload cmd-s and write a script that converts your
initial soft-tabs when you save.  Very easy to do.

Ed


More information about the textmate mailing list