Dear Steve, Dear Hans-Jörg,
many thanks for your fast replies,
I did the following: (1) As before, I considered a copy of "R Console (R.app) -> Send Document / Selection to R.app" which I called "Send all before cursor to R.app" (2) I put in the following line in the beginning [I realized that I want to execute lines (up to and) including the current one] instead of rawText="`cat`": rawText="`head -$(($TM_LINE_NUMBER))`" (3) I then executed the command via "Bundles -> R Console (R.app) -> Send all before cursor to R.app" and it worked. (4) of course it would be good to have this as a shortcut. As Hans-Jörg pointed out, my previous choice triggered another command. So I followed Hans-Jörg's suggestion and saw that "apple-key + E" and "apple-key + T" both not trigger other commands. So they are possible choices. However, when I chose either one as key equivalent, the simply did nothing/were ignored by textmate. What am I doing wrong? [I used precisely the same settings as in "Send Document / Selection to R.app", just changed the key equivalent. Hmmm... Do you know what's going on?
Cheers,
Marius
Ahh, okay, I had to switch the "scope selector" from "source.rapp-console" to "source.r" and then it worked!
Many thanks!
Marius
On 2011-04-21, at 22:29 , Marius Hofert wrote:
Dear Steve, Dear Hans-Jörg,
many thanks for your fast replies,
I did the following: (1) As before, I considered a copy of "R Console (R.app) -> Send Document / Selection to R.app" which I called "Send all before cursor to R.app" (2) I put in the following line in the beginning [I realized that I want to execute lines (up to and) including the current one] instead of rawText="`cat`": rawText="`head -$(($TM_LINE_NUMBER))`" (3) I then executed the command via "Bundles -> R Console (R.app) -> Send all before cursor to R.app" and it worked. (4) of course it would be good to have this as a shortcut. As Hans-Jörg pointed out, my previous choice triggered another command. So I followed Hans-Jörg's suggestion and saw that "apple-key + E" and "apple-key + T" both not trigger other commands. So they are possible choices. However, when I chose either one as key equivalent, the simply did nothing/were ignored by textmate. What am I doing wrong? [I used precisely the same settings as in "Send Document / Selection to R.app", just changed the key equivalent. Hmmm... Do you know what's going on?
Cheers,
Marius
So I followed Hans-Jörg's suggestion and saw that "apple-key + E" and "apple-key + T" both not trigger other commands.
It’s worth noting that ⌘-E and ⌘-T are two app-level (rather than bundle-level) shortcuts for
1. Use current selection for the Find command (complemented by ⌘-⇧-E to set replace) 2. Open file in project, with fuzzy filename matching.
I use both of these quite often, but they’re not easily discovered.
Also, Just like you can bind to ⌘-S to run a command every time you save, I’m sure if you bind to these you won’t stomp on their default behavior, but if you work in projects often, ⌘-T might not be a good choice.
You can bind to whatever keys you like, of course, but may I suggest using the same ⌘R combo that's used to invoke the command in the regular bundle? If you plan to use your modified command exclusively you can just delete the original's keystroke. If you plan to use both commands in different circumstances it's okay to have them both bound to the same key. When there's a conflict like this (multiple commands bound to the same keystroke, all valid in the current scope) it pops up a menu of choices. You can select the one you want by number. So, ⌘R1 would invoke the original command, ⌘R2 would invoke the modified version.
As an example, try ⌃⇧A (ctrl-shift-A). That key is used as a catch-all by a lot of bundles. Assuming you have any of those installed you should see the pop-up with a bunch of choices.