gadenbuie / shrtcts

Make Anything an RStudio Shortcut
https://pkg.garrickadenbuie.com/shrtcts/
Other
119 stars 4 forks source link

Add helper for inserting text #15

Open gadenbuie opened 3 years ago

gadenbuie commented 3 years ago

In cases where the goal of the shortcut is to add an option to insert text. This is possible with a wrapper around rstudioapi functions, but requires a bit of boilerplate.

#' Insert New Pipe
shrtcts::insert_text(" |> ", where = "activeDocument")

https://rstudio.github.io/rstudioapi/reference/rstudio-editors.html

gadenbuie commented 3 years ago

Would also be nice to check (or add option to check) for spaces around the text, e.g. to add whitespace before and after if not already present.