[TxMt] Some feature requests

Allan Odgaard allan at macromates.com
Sun Sep 25 08:42:04 UTC 2005

On 25/09/2005, at 9.15, Kevin Ballard wrote:

> On Sep 25, 2005, at 2:59 AM, Frédérik Bilhaut wrote:
>> - I use to write large documents in XML, and I use the soft  
>> wrapping feature. But unfortunately the indentation is not  
>> properly handled in this mode, since only the first "physical"  
>> line gets indented. You probably now JEdit does that very well, I  
>> may send a screenshot if you wish.

Indented soft wrap is something I plan for 1.3.

> I have never used an editor that indented soft-wrapped lines. I  
> would think that would be annoying because the editor would control  
> the indentation, not you.

I haven't used an editor which supported it myself, but I think given  
proper regexps and setting it on a scope level might allow for quite  
a lot of flexibility, so e.g. only comments in source code would be  
wrapped and indented, bullet points would have the bullet included in  
the indent of next line etc.

>> - I need some way to close XML tags automatically with the  
>> easyiest possible keystroke. For some reason, the shortcut for  
>> this feature does not work on my system (Tiger on iBook G4 and  
>> latest version of TextMate).

Not sure if latest version is 1.1b17 from the webpage or actually  
latest build (rev. 469), you can get the latter from: http:// 
get.textmate.org -- and I have done some workaround for a menu key  
problem since the actual 1.1b17, so this might be the problem.

>> Also, I think that the JEdit way to do this is very good : you  
>> just have to type "</" and the rest of the closing tag comes up  
>> automatically. For me this is far more natural than typing an  
>> arbitrary keystroke.
> It may be possible to write a macro or something to do a closing  
> tag when typing </ without requiring any changes to the actual  
> program, but if so I don't know how. Allan?

Indeed it is: In an HTML document, type < (it inserts <>, but ignore  
that), now do:
  1) Automation / Start Macro Recording
  2) Backwards delete (to delete <, which also removes >)
  3) Automation / Insert Closing Tag
  4) Automation / Stop Macro Recording

Now save this macro, give it key equivalent /, and here's the sneaky  
part: set the scope to: text.html invalid.illegal.incomplete

The scope controls when the macro should “fire”, and if you press  
ctrl-shift P inside <>, you'll see the scope of that position, which  
is what's quoted above. So only inside <> will / fire this macro,  
which first removes the <> and then inserts the closing tag.

In a future version input patterns will be another way to achieve the  
same, w/o having to use scopes.

>> - And of course, having the possibility to have a simple file  
>> browser without creating a project would be great.

Try dragging a folder to TextMate, then it'll make a project out of  
the folder, you can navigate it either using the project drawer, or  
using Navigation / Go to File (cmd T) which beats most file browsers :)

More information about the textmate mailing list