0

It's great in RStudio to have already a key short-cut for <-, which is ALT+-.

Wouldn't it be also great to have also a short-cut for %>%, which is possibly the second most frequent key sequence (after <-) that R programmers type?

Or maybe there is already one?

IVIM
  • 2,167
  • 1
  • 15
  • 41
  • 5
    "which is the second most frequent key sequence (after "->") that R programmers type" This is definitely not true for *all* R programmers. – Dason Jun 16 '17 at 17:17
  • 14
    `ctrl + shift + m` – Phil Jun 16 '17 at 17:20
  • 1
    Also I just noticed you said `->`. Who uses `->` more than `<-`?!? – Dason Jun 16 '17 at 17:23
  • 1
    Page 2: https://www.rstudio.com/wp-content/uploads/2016/01/rstudio-IDE-cheatsheet.pdf. Also, I believe OP meant to say `<-`, because Alt + - is `<-` – Mark White Jun 16 '17 at 17:25
  • 1
    The problem I always have with these shortcuts is that they take just as many keys as typing `%>%` directly. – alistaire Jun 16 '17 at 17:29
  • @alistaire I mean I partially get your point and if you rely too much on the shortcuts then it can be super annoying when you use a different editor. But at least in this case you do actually save some keystrokes. – Dason Jun 16 '17 at 17:32
  • @Dason One, but since two are the same in `%>%`, it's the same number of keys. Plus I don't have to alter my typing position to type `%>%`, which I do to type Ctrl-Shift-m. – alistaire Jun 16 '17 at 17:34
  • Check out the [RStuidio IDE cheat sheet](https://www.rstudio.com/wp-content/uploads/2016/01/rstudio-IDE-cheatsheet.pdf) where this and other shortcuts are listed. – MrFlick Jun 16 '17 at 18:03

1 Answers1

0

If you want to solve this in rstudio you can create an addin and reference a custom shortcut to your addin. Here is the reference page which will guide you through the process: https://rstudio.github.io/rstudioaddins/

  • 11
    You don't need to; it's already bound to `ctrl + shift + m` – Phil Jun 16 '17 at 17:25
  • Thanks for pointing that out. Maybe a bit of an overkill then... – user3156848 Jun 16 '17 at 17:28
  • Phil - Yes! - As simple as ctrt+shift+m. - Please post it as answer, I'll check it as the answer I've been looking for . Thanks to all those who provided constructive feedback – IVIM Jun 16 '17 at 18:19