Snippets in text files?


#1

Is there a way I can use snippets in what atom see’s as a plain text file? I’m currently coding for a program that reads scripts in a folder with the file type ‘.zs’ and snippets don’t seem to work for it.


#2

The structure of snippets is pretty simple. It is in CSON format and looks like this:

'.source.coffee':
  'Describe':
    'prefix': 'desc'
    'body': "describe '$1', ->$0"

The lines in the above example are:

  1. The scope that the following snippets apply to. For plain text this would be .text.plain
  2. This is the name of the snippet
  3. The prefix is what you have to type before hitting the snippet activation key (defaults to TAB)
  4. What the snippet expands into

#3

ok but, i can put more snippet in there?


#4

If you’re asking if you can put more snippets in your keymap.cson, the answer is yes.


#5

If you’re asking whether you can put more snippet in your coffee and sip it with some toffee… the answer is also yes.