Skip to content

Instantly share code, notes, and snippets.

@bondydaa
Last active November 4, 2016 22:31
Show Gist options
  • Save bondydaa/cc4b32a1593339479dca91ba853162fa to your computer and use it in GitHub Desktop.
Save bondydaa/cc4b32a1593339479dca91ba853162fa to your computer and use it in GitHub Desktop.
Atom snippets for PHP coding
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# https://atom.io/docs/latest/using-atom-basic-customization#cson
'.source.php':
'var_dump variable into HTML':
'prefix': 'debug'
'body': """
echo '<pre>';
var_dump($1);
echo '</pre>';
echo '<hr>';
"""
'Create a comment':
'prefix': 'comment'
'body': """
/**
* $1
*/
"""
@bondydaa
Copy link
Author

bondydaa commented Nov 4, 2016

Things to note:

  1. you can only have 1 .source.[language] key in this file
  2. be wary of your indentation, if the keys for a each snippet are not the same then they won't render out.

IE: lines 24 and 33 need to be the same indentation, if line 33 is indented over to the right again it won't render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment