1

Is there a way to change behaviour of CTRL+C in R. Currently it is exiting R terminal, I prefer at least it asks if it should exit the terminal, or just clean the current line as it does when you run R through Rstudio

Edit 1: I am using R through command prompt in Windows. Not through RStudio.

adam
  • 655
  • 1
  • 10
  • 31
  • isn't this just the default behaviour on most (if not all) terminals – L_Church Feb 12 '18 at 13:54
  • CTRL-C usually maps to the SIGINT signal. Reading up on `help(conditions)` will supposedly tell you how to trap that signal, as said here: https://stackoverflow.com/a/27950919/3688648 – Felk Feb 12 '18 at 13:56
  • press `Esc` key for clearing the current line on RStudio console. `Ctrl+D` also works. – Sathish Feb 12 '18 at 14:33
  • modify keyboard shortcuts: https://support.rstudio.com/hc/en-us/articles/206382178?version=0.99.903&mode=desktop – Sathish Feb 12 '18 at 14:37
  • @Sathish I am not using RStudio, I am calling R through command prompt directly – adam Feb 13 '18 at 09:22
  • I think you need to change the .lnk file for setting windows shortcuts. `R.utils` package has function to get and set shortcuts such as `readWindowsShellLink` – Sathish Feb 13 '18 at 10:19
  • 1
    on the current line, press `Home` to move the cursor to the beginning of the line. Then press `Ctrl+K` – Sathish Feb 13 '18 at 10:33

1 Answers1

1

@Sathish answer seems to be working. Home then Ctrl + K. Thanks

adam
  • 655
  • 1
  • 10
  • 31