Nick
Nick

Reputation: 3384

Shortcut for commenting in Rmarkdown?

Simple question: does anyone know of a shortcut key for commenting in Rmd?

In Knitr this can be done using CTRL + C, which produces in both writing and coding environment a comment line. This does not work in Rmd unfortunately.

At the moment I have to type out:

<!-- Comments --> 

I am using R-studio.

Upvotes: 0

Views: 3203

Answers (1)

hrbrmstr
hrbrmstr

Reputation: 78842

Add a snippet under the "markdown" section:

enter image description here

(I made mine hcm) then type:

hcmShiftTab and it'll expand to whatever you want (mine was <!-- -->)

You can make the snippet text shorter as well.

I agree with Ben that you could go to RStudio support and ask for a kbd shortcut for this.

Upvotes: 4

Related Questions