Hi,
I just switched to Textmate to write my R scripts and I admit outright there are many features of Textmate that I do not master yet. I am confident I'll enjoy this new environment to write my R scripts.
I have a small problem though. I was looking forward to the ability to send lines or the selection to R.app without doing cut and paste, as I used to do with my other text editor.
But when I do this using the R bundle's "shift-option-command-R" keyboard shortcut (or using the command from the Bundle's menu), my selection is preceded by a setwd() to the folder where my script resides. Except that often my working directory was set at the beginning of my script to be elsewhere than where the script resides.
I am curious: why was this considered advantageous in the first place? And second, can it be disabled (and how)? Also, can one change the keyboard shortcuts? I do not use R from Terminal, so I'd like to switch the keyboard equivalent to something that is less demanding on my fingers, say control-R or command-R.
Thanks in advance,
Denis Chabot
On Sun, Mar 29, 2009 at 8:04 AM, Denis Chabot chabotd@globetrotter.net wrote:
Hi,
I just switched to Textmate to write my R scripts and I admit outright there are many features of Textmate that I do not master yet. I am confident I'll enjoy this new environment to write my R scripts.
I have a small problem though. I was looking forward to the ability to send lines or the selection to R.app without doing cut and paste, as I used to do with my other text editor.
But when I do this using the R bundle's "shift-option-command-R" keyboard shortcut (or using the command from the Bundle's menu), my selection is preceded by a setwd() to the folder where my script resides. Except that often my working directory was set at the beginning of my script to be elsewhere than where the script resides.
I am curious: why was this considered advantageous in the first place?
I personally prefer this behavior as the scripts I write usually reside in the same directory (or in a consistent relative path) to where the relevant data files are. That way I don't have to put any full paths in my scripts and they are easier to send to others.
And second, can it be disabled (and how)? Also, can one change the keyboard shortcuts? I do not use R from Terminal, so I'd like to switch the keyboard equivalent to something that is less demanding on my fingers, say control-R or command-R.
You can easily change both of these things. The manual covers how to change Key Equivalents (shortcuts) here http://manual.macromates.com/en/bundles
To change the working directory behavior, open up the R bundle in the bundle editor and select the command (little green circle) named "R.app". Change the following line from:
-e 'end run' -- "$rawText" "$curDir"
to:
-e 'end run' -- "$rawText" ""
In two seconds of testing, that did the trick on my system.
HTH
Peter
Thanks in advance,
Denis Chabot
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Thanks a lot for this useful answer, Peter.
But before changing this behavior in the R Bundle, I'll try changing my working habits a bit (where I store my scripts vs my data) to see if I'll find this an improvement or not.
Denis Le 09-03-29 à 13:54, Peter Cowan a écrit :
On Sun, Mar 29, 2009 at 8:04 AM, Denis Chabot <chabotd@globetrotter.net
wrote: Hi,
I just switched to Textmate to write my R scripts and I admit outright there are many features of Textmate that I do not master yet. I am confident I'll enjoy this new environment to write my R scripts.
I have a small problem though. I was looking forward to the ability to send lines or the selection to R.app without doing cut and paste, as I used to do with my other text editor.
But when I do this using the R bundle's "shift-option-command-R" keyboard shortcut (or using the command from the Bundle's menu), my selection is preceded by a setwd() to the folder where my script resides. Except that often my working directory was set at the beginning of my script to be elsewhere than where the script resides.
I am curious: why was this considered advantageous in the first place?
I personally prefer this behavior as the scripts I write usually reside in the same directory (or in a consistent relative path) to where the relevant data files are. That way I don't have to put any full paths in my scripts and they are easier to send to others.
And second, can it be disabled (and how)? Also, can one change the keyboard shortcuts? I do not use R from Terminal, so I'd like to switch the keyboard equivalent to something that is less demanding on my fingers, say control-R or command-R.
You can easily change both of these things. The manual covers how to change Key Equivalents (shortcuts) here http://manual.macromates.com/en/bundles
To change the working directory behavior, open up the R bundle in the bundle editor and select the command (little green circle) named "R.app". Change the following line from:
-e 'end run' -- "$rawText" "$curDir"
to:
-e 'end run' -- "$rawText" ""
In two seconds of testing, that did the trick on my system.
HTH
Peter
Thanks in advance,
Denis Chabot
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate