I am trying to write a snippet to allow me to quickly insert comment text using my standard format:
#######################################><###################
## [date and time goes here] ------------------------------
## [comment goes here, can span multiple
## lines]
#######################################><###################
This is what I've got so far:
snippet comm
`r paste0(
"#######################################><###################\n## ",
date(),
" -------------------------------\n## ",
eval(
paste0(
gsub(
".{1,51}\\s?\\K\\b",
"\n## ",
gsub("\\.", " ", paste0(text)),
perl = T
)
)
),
"###################################><###################\n"
)`
This snippet works, but requires that the comment text not have any spaces in it. As a work around, I've written the snippet to interpret .
as a space.
commlong.comment.text.1111111.aaaaaaa.2222222.bbbbbbb.3333333.ccccccc.4444444.ddddddd.5555555.eeeeeee.6666666.fffffff.7777777.ggggggg.8888888.9999999.0000000
#######################################><###################
## Tue Jul 24 12:40:55 2018 -------------------------------
## 1111111 aaaaaaa 2222222 bbbbbbb 3333333 ccccccc
## 4444444 ddddddd 5555555 eeeeeee 6666666 fffffff
## 7777777 ggggggg 8888888 9999999 0000000
## ###################################><###################
Since typing comments with periods instead of spaces is a pain, I'd like to modify my snippet to accept comment text with spaces. Any ideas how to do that? Thanks.