[TxMt] Auto-Paired with Spaces

Rob McBroom textmate at skurfer.com
Wed Aug 29 20:41:54 UTC 2007


On Aug 19, 2007, at 4:56 PM, squirrelturtle wrote:

> How can you make it so when you press a '(' when editing source- 
> code '(  )'
> is inserted instead of '()', that is, there are two spaces between the
> brackets and the cursor is in-between those two spaces? It makes  
> code much
> easier to read.

I made a snippet with ( for a tab trigger. It inserts "( $0 ". So if  
you hit ⇥ inside the parentheses, it spaces them out and leaves the  
cursor in the middle. Remembering to hit ⇥ is a pain, but it works.

I used to have empty parentheses defined as its own scope and could  
then change the behavior of the space bar in that scope, which made  
it more natural, but it was a pain to define this scope in any  
language I wanted to use it in (and repeat the process when those  
languages were updated).

Hopefully one day you'll be able to define this "spacing out"  
behavior the same way indentation is done automatically when you hit  
↩ inside {}, for example.

---
Rob
<http://www.skurfer.com/>





More information about the textmate mailing list