Rstudio shortcut for copying from console to source?

After several years of using this site, I finally post my first question!

In RStudio, I often develop a line of code in the console, and then, as soon as I am 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 was a key combination.

I do not see anything in this list in shortcuts keys RStudio (click → the Tools Keyboard Shortcuts Help). The only way I decided to do this using the keyboard is as follows:

  • Type a command on the console (do not press Enter)
  • Ctrl + U (copy line to cursor)
  • Ctrl + 1 (go to source)
  • Ctrl + Y (insert line)
  • Ctrl + 2 (return to the console)

Question: As you can see, this is not a lot of shortcut. Any other hacks? Or even better, is there a way to define RStudio key combinations in addition to those already defined?

Environment:
RStudio version 1.0.44
R version 3.3.2
Mac OSX 10.11.6

+4
source share

Source: https://habr.com/ru/post/1663434/


All Articles