Assigning a keyboard shortcut for a RMarkdown template

This part sounds like a regular package that you could distribute in a few different ways, see e.g.

The second part, of creating a template and a shortcut could be accomplished by making an RStudio addin, which could be part of your package or separate, it's just a matter of preference. You can assign keyboard shortcuts to addins, which would, in effect, allow you to have a shortcut for your template (I think).

The closest thing that comes to mind is the New Post option in blogdown, which you can select from the addins dropdown (and, if so desired, add a keyboard shortcut to open it).

It looks like the code for that is here: blogdown/inst/scripts/new_post.R at main · rstudio/blogdown · GitHub

It opens a little shiny gadget in which you enter the post title, etc., and then (once you've pressed ok) opens up the appropriate document:

Hopefully some of these resources can get you started! I've never made an addin, but there are lots of good examples in this thread, as well as a webinar which I've also linked to, below.

https://www.rstudio.com/resources/webinars/understanding-add-ins/

3 Likes