Multiple user-defined script templates

I can create a default script template as outline here. Specifically, I place my template file, called default.R, in the ~/.config/rstudio/templates/ directory and all new files adopt that structure. Great!

My question is, can I create multiple templates that I can choose from? I'm thinking of something like when I create an RMarkdown file and I'm given several options to select from. I have already tried placing additional templates in ~/.config/rstudio/templates/, but RStudio just uses the default template instead.

I know there was a discussion about this a few years ago, but as the UI functionality wasn't there yet, it wasn't implemented. Has anything changed in that regard?

Nope, there's nothing new here. If you want this level of functionality, you could create an RStudio add-in that has a command that will prompt you for a template name, open a new document, and insert your desired template text.

https://rstudio.github.io/rstudioaddins/

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.