Managing snippets

rstudio
snippets
#1

I have a ton of snippets saved in github gists. The issue is there are a lot of them and github search is not very usable when I need a chunk of code to insert into my RStudio.

How do you manage your snippets? Any tool or suggestion, even using the snippets option in RStudio (not very suitable to my needs in my humble opinion) is welcome

0 Likes

#2

Check out snippr, a package to "manage, share, and install RStudio code snippets"

I mainly use it because I switch computers ~regularly, and like to keep my snippets synchronized.

2 Likes

#3

Thanks a lot Mara, very useful

1 Like

#4

Tried but sadly, seems that is useful for saving and sharing snippets only. My exact need is the opposite, having a bunch of snippets, choose one and insert it in my code...in the most simple way. This forces me to get the unique ID from a gist, very convoluted procedure

0 Likes

#5

Take a look at this gorgeous snippet/Gists manager

0 Likes

#6

Ah, I think I understand now. So, basically, an interface for navigating your files here:

0 Likes

#7

yep, an easy way of organising snippets by category (maybe nodes in a tree) and just click on one of them and then appeared the chunk in my Rscript

0 Likes

#8

Do your snippets make use of the auto-fill/select and cursor-placement features (e.g., ${1:dataset} in Mara's aa snippet, above), or are they more like plain chunks of boilerplate or example solutions to specific problems? Or a mixture of both?

0 Likes

#9

A mixture of both
Some just code and some more interactive

0 Likes