Inserting code easily


#1

Hi everybody! I’ve seen many livecoders in Sonic Pi that, just typing a single word, can load a chunck of code in the current buffer. How can I do that? Thanks in advance!!


#2

@arcedeviento - what you are noticing is an undocumented feature that is still considered not complete or ready enough for full official support - snippets.
How this currently works: Sonic Pi always reads a folder of snippet files (files which specify what the shortcuts are, and what output they trigger) at Sonic Pi start up.
The folder is [Sonic pi directory]/etc/snippets - eg on a mac, /Applications/Sonic Pi.app/etc/snippets.
The other alternative is to place similar files to those in this folder, in another location of your own choosing, and in a Sonic Pi buffer, write:
load_snippets('path/to/custom/snippets')


#3

So cute!! I’ll give a try! Thank you so much!!