My elves. They type so I don't have to.
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
+emacs-lisp-ert-mode +emacs-lisp-ert-mode: redo ert-deftest snippets Apr 6, 2017
+javascript-gulp-mode gulpjs-project-mode => +javascript-gulp-mode Mar 23, 2017
+javascript-lb6-mode Rename project modes Mar 22, 2017
+lua-love-mode Rename project modes Mar 22, 2017
+php-laravel-mode Remove illegal filename characters for windows support #2 Jan 25, 2018
+web-angularjs-mode Rename project modes Mar 22, 2017
+web-react-mode +web-react-mode: adjust indent in React.createClass snippet Mar 28, 2017
ansible-mode Remove executable permission on snippets Jun 8, 2018
applescript-mode Initial commit Jun 6, 2015
buttercup-minor-mode Add buttercup-minor-mode snippets Jun 8, 2018
c++-mode c/c++: add #include + using snippet Mar 31, 2016
c-mode c-mode: remove aliases Oct 2, 2016
cc-mode cc-mode/main: expand from bolp & region support Aug 27, 2018
cmake-mode Initial commit Jun 6, 2015
conf-unix-mode Initial commit Jun 6, 2015
cpp-omnet-mode Initial commit Jun 6, 2015
csharp-mode Initial commit Jun 6, 2015
css-mode Remove executable permission on snippets Jun 8, 2018
dockerfile-mode Remove broken links and snippet symlinks (don't work anymore) Jan 2, 2017
emacs-lisp-mode emacs-lisp-mode: add defconst snippet Sep 13, 2018
enh-ruby-mode Initial commit Jun 6, 2015
erc-mode Initial commit Jun 6, 2015
fundamental-mode Fix dependencies & compile warnings Jun 8, 2018
gfm-mode Add gfm-mode (parent: markdown-mode) Jul 4, 2017
git-commit-mode Initial commit Jun 6, 2015
go-mode Fix additional troublesome Windows characters Mar 12, 2018
haskell-mode haskell-mode: simpler function snippet Jan 4, 2017
html-mode html-mode: update link and mailto snippets Jan 4, 2017
java-mode Remove file templates (moved to emacs.d) Jun 25, 2015
js-mode js-mode: change getElementById key to gebi May 12, 2018
js2-mode Initial commit Jun 6, 2015
json-mode Add json-mode + eslintConfig snippet Mar 28, 2017
latex-mode Initial commit Jun 6, 2015
lisp-interaction-mode Initial commit Jun 6, 2015
lisp-mode Add lisp-mode snippets Aug 1, 2018
lua-mode Remove illegal filename characters for windows support #2 Jan 25, 2018
m4-mode Initial commit Jun 6, 2015
makefile-automake-mode Initial commit Jun 6, 2015
makefile-bsdmake-mode Initial commit Jun 6, 2015
makefile-gmake-mode Remove file templates (moved to emacs.d) Jun 25, 2015
makefile-mode Initial commit Jun 6, 2015
markdown-mode Change markdown-mode/link Jul 4, 2017
nesc-mode Initial commit Jun 6, 2015
nsis-mode Initial commit Jun 6, 2015
nxml-mode Initial commit Jun 6, 2015
org-mode org-mode: add 'width', fix caps in 'src' May 12, 2016
php-mode php-mode: add foreach, switch, url{de,en}code snippets May 12, 2017
processing-mode Add processing-mode snippets Apr 8, 2016
prog-mode Add no-byte-compile flags to .yas-setup.el files Feb 20, 2017
pug-mode Add pug-mode snippet Jan 7, 2017
python-mode python-mode: fix indentation due to empty lines Mar 31, 2018
rjsx-mode Add rjsx-mode snippets Mar 30, 2017
rspec-mode Remove executable permission on snippets Jun 8, 2018
rst-mode Initial commit Jun 6, 2015
ruby-mode Update ruby-mode snippets Jan 1, 2016
rust-mode Redo rust-mode snippets + add new ones Mar 5, 2018
scala-mode Add scala-mode snippets May 12, 2016
scss-mode Remove executable permission on snippets Jun 8, 2018
sh-mode Remove illegal filename characters for windows support #2 Jan 25, 2018
slim-mode Fix additional troublesome Windows characters Mar 12, 2018
snippet-mode Remove condition on snippet-mode/vars Sep 30, 2015
sql-mode Initial commit Jun 6, 2015
text-mode Remove file templates (moved to emacs.d) Jun 25, 2015
typescript-mode Add typescript snippets; update js snippets Jun 6, 2016
web-mode Add web-mode/php snippet Sep 13, 2018
yaml-mode Initial commit Jun 6, 2015
.editorconfig Add editorconfig Jan 1, 2016
.gitignore Initial commit Jun 6, 2015
LICENSE Update README + LICENSE Mar 31, 2016
README.md Mention yas-reload-all for yasnippet minor mode in readme Jan 1, 2018
emacs-snippets.el Update package headers Aug 17, 2018

README.md

MIT

Emacs Yasnippet Library

My personal yasnippet snippets for my emacs.d.

Notes to snippet authors

  • % is aliased to yas-selected-text for convenience.

  • My emacs config has project-specific minor modes. A + prefix denotes these minor modes, e.g. +php-laravel-mode.

  • This library uses a lot of custom helper functions, like (!%!) and (%1). These are defined in fundamental-mode/.yas-setup.el. See their docstrings to see what they do.

  • The (%alias TRIGGER &optional MODE) function is available for setting up multiple triggers for one snippet. e.g.

    ;; js-mode/class
    # name: class
    # --
    class ${1:Name} {
        $0
    }
    
    ;; js-mode/cl
    # name: class
    # uuid: cl
    # type: command
    # --
    (%alias "class")

    Note: if your alias snippets share the same name, they must have a unique uuid.

Install

Clone this repo somewhere, then add its directory to load-path, and...

(require 'emacs-snippets)
;; OR
(use-package emacs-snippets :after yasnippet)

emacs-snippets sets itself up when yasnippet first loads.

If you're using Doom Emacs, place this in any module's packages.el:

(package! emacs-snippets
  :recipe (:fetcher github
           :repo "hlissner/emacs-snippets"
           :files ("*")))

Note: if you use yas-minor-mode (instead of yas-global-mode), you must manually call yas-reload-all. Doom does this in feature/snippets for you:

;; Ensure `yas-reload-all' is called as late as possible. Other modules could
;; have additional configuration for yasnippet. For example, file-templates.
(add-transient-hook! 'yas-minor-mode-hook (yas-reload-all))