[TxMt] Overloading the tab key
skiadas at hanover.edu
Thu Apr 5 21:40:01 UTC 2007
On Apr 5, 2007, at 5:15 PM, Steve King wrote:
> On Thu, 5 Apr 2007, Rob McBroom wrote:
>> 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.
> This *almost* works, but my language-grammar-fu is not strong
> enough. In the C grammar, for example, I haven't been able to come
> up with a scoping rule to select '^\s*' that doesn't interfere with
> existing rules which contain whitespace anchored at the start of
> the line (like pre-processor directives). I think I'd have to edit
> every existing rule which contains '^\s*' to capture that leading
> whitespace into its own scope. That's way more grief than I'm
> looking for.
> And, as I reflect on it some more, just re-assigning the tab key
> isn't exactly what I want. I also want cmd-] to insert hard tabs
> to indent a block, which wouldn't happen with this technique.
> Though I suppose I could write another command for cmd-] that would
> do that.
I actually think what you want is to leave the tab key alone, and the
same for the other keys, and to just write a trivial 3 line script to
do the kind of change you need to the entire document whenever it's
run. (I think someone already suggested something similar). Then,
assuming you use some sort of svn type system, you should be able to
have a pre/post-commit hook or whatnot that runs this script.
> Steve King, <steve at narbat.com>
Department of Mathematics and Computer Science
More information about the textmate