es6-snippets
es6-snippets copied to clipboard
A collection of Yasnippets for writing ECMAScript2015 in Emacs
#+TITLE: es6-snippets.el #+AUTHOR: Cody Reichert #+EMAIL: [email protected] #+DESCRIPTION: A collection of Yasnippets for writing EcmaScript 2016 in GNU Emacs #+LANGUAGE: en
es6-snippets.el is a collection of [[https://github.com/capitaomorte/yasnippet][Yanippets]] for writing EcmaScript 2015 in Emacs.
This is almost comprehensive, but snippets are still being changed and added.
See the [[https://people.mozilla.org/~jorendorff/es6-draft.html][ES6 Standard draft]] for a full spec.
** Installation First get the source:
#+BEGIN_SRC sh $ git clone [email protected]:codyreichert/es6-snippets ~/.emacs.d/es6-snippets #+END_SRC
Then require the package:
#+BEGIN_SRC emacs-lisp (add-to-list 'load-path "~/.emacs.d/es6-snippets") (require 'es6-snippets) #+END_SRC
/There's plenty of other ways, so do what works best for you/
** Prerequisites Yasnippets needs to be enabled, but once once it is and you've required the package in your init.el, snippets will be available in =web-mode=, =js2-mode=, or =js-mode=.
** Snippets
| Snippet | Name | Description |
|---------+-------------------+---------------------------------|
| arw | arrowFunction | =($1) => { $0 }= |
| cl | class | =class $1 { $0 }= |
| cle | classExtends | =class $1 extends $2 { $0 }= |
| ccs | classConstructor | =constructor($1) { $0 }= |
| const | constant | =const $1 = $0;= |
| exp | export | =export $0;= |
| expd | exportDefault | =export default $0;= |
| expf | exportFunction | =export function $1($2) { $0 }= |
| forof | forOfLoop | =for($1 of $2) { $0 }= |
| imp | import | =import $0;= |
| let | let | =let $1 = $0;= |
| map | map | =new Map($0);= |
| prom | promise | =new Promise(($1) => { $0 });= |
| px | proxy | =new Proxy($1, $0);= |
| set | set | =new Set($0);= |
| spr | spread | =(...$1)$0= |
| si | stringInterpolate | =${$0}= |
| sup | super | =super($0)= |
| sym | symbol | =Symbol($0);= |
| ts | templateString | =$0
= |
| wmap | weakMap | =new WeakMap($0);= |
| wset | weakSet | =new WeakSet($0);= |
** Contributing Please do. Open an issue or a pull request if you need a snippet added, want to discuss changing a key binding, or have any issues.
I know I didn't get to all of them, and there are some I intentionally left off, but I'm open to adding or changing any snippets.
- [ ] Shorter bindings. If I can figure out there won't be clashed with the other JavaScript Yasnippets, I would like to shorten some of these key bindings.
- [ ] Full coverage for EcmaScript 2015
- [ ] MELPA package
** License **** This software is licensed under the GNU General Publice License Version 3.0
This program is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version. This program is
distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details. You should have received a copy of the
GNU General Public License along with this program. If not, see
http://www.gnu.org/licenses/