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