Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I send selected text (or a line) in TextMate to R running on Terminal

I just started using R on Terminal because its tab function. But I have no idea how to send the selected text in TextMate to the Terminal. Could expertise show me how to write the Command in TextMate?

Thanks!

like image 917
Naiqi Avatar asked Feb 09 '12 19:02

Naiqi


2 Answers

Here is the exact TextMate command that I currently use. Hope it helps!

rawText="$(cat | sed 's/ / /g;')" 

osascript  -e 'on run(theCode)' \
           -e '  tell application "Terminal"' \
           -e '    do script theCode in window 1' \
           -e '  end tell' \
           -e 'end run' -- "$rawText"

open "txmt://open?line=$(($TM_LINE_NUMBER+1))&column=1000000" &

enter image description here

like image 125
John Colby Avatar answered Nov 14 '22 22:11

John Colby


TextMate is MacOS, right? Is so, then this is from the R ?connections page:

"Mac OS X users can use pipe("pbpaste") and pipe("pbcopy", "w") to read from and write to that system's clipboard."

You can "paste" from R-Clipboards into Terminal sessions. You can also send file content from TextMate: http://manual.macromates.com/en/shell_commands#executing_commands_filtering_text

like image 23
IRTFM Avatar answered Nov 14 '22 23:11

IRTFM