shrtcts icon indicating copy to clipboard operation
shrtcts copied to clipboard

Add helper for inserting text

Open gadenbuie opened this issue 3 years ago • 1 comments

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 avatar May 19 '21 14:05 gadenbuie

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.

gadenbuie avatar May 19 '21 14:05 gadenbuie