hunterboerner / es6-snippets

A collection of Yasnippets for writing ECMAScript2015 in Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

A collection of Yasnippets for writing ECMAScript2015 in Emacs


Languages

Language:Emacs Lisp 100.0%