/es6-snippets

A collection of Yasnippets for writing ECMAScript2015 in Emacs

Primary LanguageYASnippet

es6-snippets.el

es6-snippets.el is a collection of Yanippets for writing EcmaScript 2015 in Emacs.

This is almost comprehensive, but snippets are still being changed and added.

See the ES6 Standard draft for a full spec.

Installation

First get the source:

$ git clone git@github.com:codyreichert/es6-snippets ~/.emacs.d/es6-snippets

Then require the package:

(add-to-list 'load-path "~/.emacs.d/es6-snippets")
(require 'es6-snippets)

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

SnippetNameDescription
arwarrowFunction($1) => { $0 }
clclassclass $1 { $0 }
cleclassExtendsclass $1 extends $2 { $0 }
ccsclassConstructorconstructor($1) { $0 }
constconstantconst $1 = $0;
expexportexport $0;
expdexportDefaultexport default $0;
expfexportFunctionexport function $1($2) { $0 }
forofforOfLoopfor($1 of $2) { $0 }
impimportimport $0;
letletlet $1 = $0;
mapmapnew Map($0);
prompromisenew Promise(($1) => { $0 });
pxproxynew Proxy($1, $0);
setsetnew Set($0);
sprspread(...$1)$0
sistringInterpolate${$0}
supsupersuper($0)
symsymbolSymbol($0);
tstemplateString`$0`
wmapweakMapnew WeakMap($0);
wsetweakSetnew 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/