After years of using this site, I'm finally posting my first question!
In RStudio, I often develop a line of code in the console, and then once satisfied, I copy and paste it into my source code. Since I do this many times a day, I thought it would be great if there were a keyboard shortcut.
I don't see anything for this listed in RStudio's keyboard shortcuts (click on Tools -> Keyboard Shortcuts Help
). The only way I've figured out to do this via the keyboard is the following:
- Type command at console (don't hit Enter)
Ctrl + U
(copy line up to cursor)Ctrl + 1
(switch to source)Ctrl + Y
(paste line)Ctrl + 2
(switch back to console)
Question: As you can see, this is not much of a shortcut. Any other hacks? Or better yet, is there a way to define RStudio keyboard shortcuts in addition to the ones that are already defined?
Environment:
RStudio version 1.0.44
R version 3.3.2
Mac OSX 10.11.6