Skip to content

Instantly share code, notes, and snippets.

@jinzhubaofu
Created December 29, 2016 08:05
Show Gist options
  • Save jinzhubaofu/61bf815cde38da5fdce660846a9664af to your computer and use it in GitHub Desktop.
Save jinzhubaofu/61bf815cde38da5fdce660846a9664af to your computer and use it in GitHub Desktop.
atom snippets & keymap
# 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.js':
'doc':
'prefix': 'lupengyu'
'body': """
/**
* @file ${1:file}
* @author leon <lupengyu@baidu.com>
*/
${2}
"""
'ludafa':
'prefix': 'ludafa',
'body': """
/**
* @file ${1:file}
* @author leon <ludafa@outlook.com>
*/
"""
'react-component':
'prefix': 'rcc'
'body': """
class ${1:YourComponent} extends Component {
constructor(props) {
super(props);
this.state = {
${2:state}
};
}
render() {
return (
<div>`${3:render}`</div>
);
}
}
"""
'import react':
'prefix': 'importr'
'body': """
import React, {Component, PropTypes} from 'react';
"""
'.platform-darwin atom-text-editor:not([mini])':
'alt-d': 'editor:delete-line'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment