To add a code snippet to Atom, take the following steps:
.atom folder is hidden by default. Make sure to show all files and folders! The
.atom folder contains a file called snippets.cson.
'.source.python': 'clsEmployee': 'prefix': 'clsEmployee' 'body': """ class Employee: def __init__(self, name): self.name = name """
As you start typing, Atom offers your new snippet in the popup menu.
class Employee: def __init__(self, name): self.name = name
Atom snippets allow you to insert variables if needed. They are defined with a dollar sign:
'clsEmployee2': 'prefix': 'clsEmployee2' 'body': """ class Employee: def __init__(self, $1): self.$1 = $1 """
You know Atom has a user folder and where to find the snippets file. You have learned how to add a new snippet to it and how to launch it from the editor. Now you can collect your most used code blocks and start your own snippet library!