Emacs-style tab to indent line (was: [TxMt] textmate Digest, Vol 13, Issue 71)

Allan Odgaard throw-away-1 at macromates.com
Mon Oct 31 02:49:36 UTC 2005


On 31/10/2005, at 3.11, Shawn Van Ittersum wrote:

> How do we assign Tab key to the new Indent Line command ourselves,  
> since you did not do that for us?

The action method (for the key bindings dictionary) is  
“indent:” (it's actually declared by NSResponder, though  
unimplemented by NSTextView).

A more flexible method is recording a macro:

  1) Automation / Start Macro Recording   (option-cmd M)
  2) Text / Indent Line                   (option-cmd [)
  3) Automation / Stop Macro Recording    (option-cmd M)
  4) Automation / Save Scratch Macro…       (ctrl-cmd M)

Then give it TAB as key equivalent. Probably store it in an Emacs- 
compatibility bundle.

I am mentioning the macro as more flexible because this would allow  
you to:

   a) limit the scope of the key, e.g. to source files, or source  
files except comments in sources (source - comment) etc., and
   b) because you can record further actions, you can get the indent  
to trigger on other keys as well, e.g. record inserting a “;” and  
then do the Text / Indent Line, bind that macro to the ; key (limited  
in scope to sources that terminate lines by a “;”) and you get the  
line properly indented when you type a “;” character.

> p.s. Why are you making it so hard for emacs users to embrace your  
> program??

Oh come on! I never used Emacs and I never planned for TextMate to be  
Emacs -- but I have made plenty of changes to TextMate only to suit  
Emacs users. But the role-model for behavior when it comes to  
TextMate is NSTextView and OS X, that should go without saying!






More information about the textmate mailing list