This is such a simple question but I can't find any documentation besides the readme.
How can I have multiple custom snippets in Atom Editior:
For example I have this in my snippets.cson right now
'.source.js':
'Normal Comment Block':
'prefix': 'cmm'
'body': """
//**********************************************************************************
//
//**********************************************************************************
"""
'.source.js':
'Dashed Comment Block':
'prefix': 'c--'
'body': """
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
"""
But cmm doesn't work, I can only use the last item in the snippets.cson. Any ideas on how to fix this? I have about a dozen different snippets I'd like to use but I cannot figure out how to include them properly.
The configuration file format is called CSON, CoffeeScript Object Notation. Like JSON (JavaScript Object Notation) it is a text format for describing simple objects. Because of which, when you specify a key twice, like .source.js
in your example, the second instance overwrites the first. If you simply have one .source.js
everything will work fine:
'.source.js':
'Normal Comment Block':
'prefix': 'cmm'
'body': """
//**********************************************************************************
// $1
//**********************************************************************************
$0
"""
'Dashed Comment Block':
'prefix': 'c--'
'body': """
//----------------------------------------------------------------------------------
// $1
//----------------------------------------------------------------------------------
$0
"""
Additionally, I took the liberty of adding tab stops to your snippets so that when you expand the snippet, your cursor should land first inside the comment. You can enter your comment and then press TAB to exit out and continue on.