I want to write a snippet that will allow me to put a string of text in multiple locations in my code, including after a $
, to give the following expected result:
source("C:/R/Functions/[inserted_text].R")
.env$[inserted_text] <- [inserted_text]
I tried using the following snippet:
snippet srcfnc
source('C:/Users/JT/R/Functions/${1:package}.R')
.env$${1:package} <- ${1:package}
Unfortunately, this gives the result below:
source('C:/Users/JT/R/Functions/[inserted_text].R')
.env{1:package} <- [inserted_text]
I've looked here and here, but none of the suggested solutions work in RStudio. I've also tried escaping the $
with \
as suggested here
snippet test
.env${1:package}
.env$${1:package}
.env$$${1:package}
.env\$${1:package}
.env\$$${1:package}
but I get these results:
.env[inserted_text]
.env{1:package}
.env[inserted_text]
.env\{1:package}
.env${1:package}
Any suggestions? Thanks.