Sorry about the subject. The thing is, I type $('') quite a lot, so much that even a tab- trigger isn't ideal. I'd like to have a key-trigger of $ to just activate the thing. The dealbreaker though is that I also use $$ sometimes, and of course an american might use $ for some other reasons. So I wonder, can you have some "smart" entering here, like the parentheses in a way. The behaviour I'd like is that if I just type $, it will expand to $ ('$1')$0 (shorthand snippet syntax), but if I hit delete directly after typing $, it will revert the thing to a simple $-character. Hope I'm making myself clear :)
btw, Martin Ström, this could be integrated into your new prototype/ scriptaculous bundle ˆ_ˆ
Andreas
Couln't you make a command and trigger it with "$" keyboard shortcut and then exlude it from some scopes (i.e. strings etc). We want this to work with $R, $H as well. (I also have som other $-functions for my own use, $w, $T and $L)
Martin
On 7/15/06, Andreas Wahlin andreaswahlin@bredband.net wrote:
Sorry about the subject. The thing is, I type $('') quite a lot, so much that even a tab- trigger isn't ideal. I'd like to have a key-trigger of $ to just activate the thing. The dealbreaker though is that I also use $$ sometimes, and of course an american might use $ for some other reasons. So I wonder, can you have some "smart" entering here, like the parentheses in a way. The behaviour I'd like is that if I just type $, it will expand to $ ('$1')$0 (shorthand snippet syntax), but if I hit delete directly after typing $, it will revert the thing to a simple $-character. Hope I'm making myself clear :)
btw, Martin Ström, this could be integrated into your new prototype/ scriptaculous bundle ˆ_ˆ
Andreas ______________________________________________________________________ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
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?
Andreas
On Jul 15, 2006, at 14:26 , Martin Ström wrote:
Couln't you make a command and trigger it with "$" keyboard shortcut and then exlude it from some scopes (i.e. strings etc). We want this to work with $R, $H as well. (I also have som other $-functions for my own use, $w, $T and $L)
Martin
On 7/15/06, Andreas Wahlin andreaswahlin@bredband.net wrote:
Sorry about the subject. The thing is, I type $('') quite a lot, so much that even a tab- trigger isn't ideal. I'd like to have a key-trigger of $ to just activate the thing. The dealbreaker though is that I also use $$ sometimes, and of course an american might use $ for some other reasons. So I wonder, can you have some "smart" entering here, like the parentheses in a way. The behaviour I'd like is that if I just type $, it will expand to $ ('$1')$0 (shorthand snippet syntax), but if I hit delete directly after typing $, it will revert the thing to a simple $-character. Hope I'm making myself clear :)
btw, Martin Ström, this could be integrated into your new prototype/ scriptaculous bundle ˆ_ˆ
Andreas _____________________________________________________________________ _ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Jul 15, 2006, at 10: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?
You could give $("") a scope, meta.prototype.dollar-sign-empty or something (check the scope naming conventions), and bind a macro to “delete” given that scope that leaves just the “$”.
I think I hit a bug with the $ snippet parsing. I couldn't insert “$ ("$1")$0”, but “ $("$1")$0” but worked.
Attached is the example, you should add detection of '' strings. The $ snippet should be changed to not work in strings.
-- Daniel
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
On Jul 15, 2006, at 9:25 AM, Andreas Wahlin wrote:
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?
I briefly mentioned this in my previous response. This will be the default behavior if the pair was inserted as a "smart pair": If you had manually inserted (, then when you remove that the matching one that was inserted would be removed as well. The same would go for a macro that simulated you typing this in.
However, if you use a command or a snippet to insert the parentheses, then they are inserted as regular text, and TM doesn't know that it should remove both of them in this case.
Andreas
Haris
On Jul 15, 2006, at 4:36 AM, Andreas Wahlin wrote:
Sorry about the subject. The thing is, I type $('') quite a lot, so much that even a tab- trigger isn't ideal. I'd like to have a key-trigger of $ to just activate the thing. The dealbreaker though is that I also use $$ sometimes, and of course an american might use $ for some other reasons. So I wonder, can you have some "smart" entering here, like the parentheses in a way. The behaviour I'd like is that if I just type $, it will expand to $ ('$1')$0 (shorthand snippet syntax), but if I hit delete directly after typing $, it will revert the thing to a simple $-character. Hope I'm making myself clear :)
btw, Martin Ström, this could be integrated into your new prototype/ scriptaculous bundle ˆ_ˆ
Andreas
I would just assign the snippet the shortcut ⌥$ (option-shift-4) That's only an extra modifier to hold down occasionally instead of a whole extra key to type. And then you're done and can get back to work. ;)
I have a bunch of Smart Smart Typing Pairs that are basically just a snippet like $3"${1:$TM_SELECTED_TEXT}"$2$0 bound to ⌥( ⌥{ ⌥" ⌥' etc... Sometimes you want to wrap something in quotes and brackets at the same time without reselecting stuff.
$("${1:$TM_SELECTED_TEXT}")$0 bound to ⌥$ should be good enough
thomas Aylott—subtleGradient