[TxMt] Making prototypes $ easier to type

Charilaos Skiadas cskiadas at uchicago.edu
Sat Jul 15 15:29:07 UTC 2006


On Jul 15, 2006, at 9:25 AM, Andreas Wahlin wrote:

> yes, because of the $R, $V and other possible  $'s I thought that  
> one could have the backspace thingie, because I use the $ to get  
> elements at least 90% of the time. Of course, others may have it  
> different.
>
> What I was looking for was mainly a way to revert the last thing  
> done with backspace so to speak, like both parantheses disappear  
> when you just delete one of them if you just added a pair. Perhaps  
> this is hard-coded behaviour?

Two ways that I see you can do this:
1. Create a macro, with key equivalent $, that inserts a dollar sign,  
a left parenthesis and a '. Then, because these were actually  
inserted as smart pairs instead of through some snippet, backspace  
does the right thing.
2. Have the snippet do: “\$${1:('$2')}$0” and key equivalent dollar  
sign. Then you can be pressing a tab when you want to go in, or just  
type A if you want $A, or type another dollar sign followed by a tab  
to get $$.
3. Create the macro/snippet/whatever that's triggered on ctrl-$ or  
cmd-$ instead, so as not to hamper the regular use of dollar sign.
4. This is my favorite: Use the following snippet, with key  
equivalent dollar sign:
\$${1/.$|(.+)/(?1:\(')/}${1:\$}${1/.$|(.+)/(?1:'\))/} $0

With this:
  $ + tab gives you $$
$ + character + tab gives you $A
$ + characters + tab gives you $('characters here')

And it automatically adds a space after them in any case. You can of  
course adjust it to suit your needs.

> Andreas

Haris





More information about the textmate mailing list