Jose Quesada
2009-May-27 18:19 UTC
[R] a simple trick to get autoclose parenthesis on windows
Hi,
This is a simple trick to get autoclose parenthesis on windows.
If you like how StatET autocloses parens, but like to use the lighter
Vanilla R, you can use autohotkey (http://autohotkey.net) to provide
this functionality.
Simply put the below code in a text file, rename extension as .ahk and
doubleclick on it to execute.
------------------ code starts here 8< ------------------
; Vanilla R
; ============================================================#IfWinActive,
ahk_class Rgui
; autoclose parens
(::Send (){left}
"::Send ""{left}
return
------------------ code ends here 8< ------------------
Silly, but I find it very convenient.
Best,
-Jose
--
Jose Quesada, PhD.
Max Planck Institute,
Center for Adaptive Behavior and Cognition -ABC-,
Lentzeallee 94, office 224, 14195 Berlin
http://www.josequesada.name/
Jose Quesada
2009-May-31 18:20 UTC
[R] a simple trick to get autoclose parenthesis on windows
Gabor Grothendieck wrote:> Hi, I was looking for your sendcodetoR.ahk autohotkey script > but couldn't find it. Would you be able to point me to it. > Thanks. >Here's what I have right now, it also maps right alt to send code to R. You should change the ahk_class to your editor of choice (here it's vim). To get the ahk_class, you need to run the atoit_spy (comes with every autohotkey install). HTH, -Jose ; F3 and right alt will send selection to open Rgui #WinActivateForce F3:: IfWinExist, ahk_class Rgui { Send ^c ; copy selection to clipboard WinActivate ; R Console save = %clipboard% sendinput, {Raw}%save% sendinput,{enter} Sleep 1000 WinActivate, ahk_class Vim } Ralt:: IfWinExist, ahk_class Rgui { Send ^c ; copy selection to clipboard WinActivate ; R Console save = %clipboard% sendinput, {Raw}%save% sendinput,{enter} Sleep 1000 WinActivate, ahk_class Vim } return -- Jose Quesada, PhD. Max Planck Institute, Center for Adaptive Behavior and Cognition -ABC-, Lentzeallee 94, office 224, 14195 Berlin http://www.josequesada.name/