Keyboard shortcut for inserting roxygen #' comment start

前端 未结 3 683
遥遥无期
遥遥无期 2020-12-15 05:44

This question might be over-answered but I could not find one. Basically I am using RStudio and the keyboard shortcut cmd + shift + c for in

相关标签:
3条回答
  • 2020-12-15 06:16

    The absolute simplest answer is in the comments on the addins answer above and deserves its own billing (with attribution):

    Rstudio does have column selection, to get multiple cursors alt + mouse to select, or ctrl + alt and the arrow keys, then keys move forward and back by words/lines work as expected. – Peter Apr 16 '16 at 23:55

    [ETA: On Mac, ctrl + option + arrow keys or option + mouse.]

    @Peter nice. in that case you could just make a chunk of cursors at the beginning of the line and and type in #' . I doubt roxygen comments are used enough to warrant a dedicated keyboard shortcut, but it wouldn't hurt to have I guess – rawr Apr 17 '16 at 1:26

    0 讨论(0)
  • 2020-12-15 06:33

    You could use an RStudio addin, you'll need a fairly recent version of RStudio. I've just created an RStudio addin that comments/uncomments using roxygen2 tags, i.e. works just like code commenting, but with #'. The addin is hosted on github.

    Just install and attach a convenient keyboard shortcut.


    If you are interested in other available addins, see the addinmanager addin.

    0 讨论(0)
  • 2020-12-15 06:36

    This isn't exactly what you're looking for. But you can add an ROxygen2 skeleton for a function by placing your cursor inside the function then pressing ctr+alt+shift+R. Then if you hit enter in the ROxygen2 codeblock it will automatically add the backtick. So an alternate workflow, edit the function, then insert the skeleton and do the documentation that way.

    0 讨论(0)
提交回复
热议问题