Skip to main content

Yasnippet Tutorial

My firsts steps with yasnippet

Thanks go to Jake B. for his comprehensive video about Yasnippet.
This tutorial is what I grab from that excellent video.
Install yasnippet with
M-x package-install
Then enter
yasnippet
Configure yasnippet:
(use-package yasnippet
  :config
  (setq yas-snippet-dirs '("~/.emacs.d/mysnippets"))
  (yas-global-mode 1))
Create a new snippet:
M-x yas-new-snippet
Save it under the yas-snippet-dirs sub-directory corresponding to the mode you want it to apply: if the snippet is for php-mode, then save it under
~/.emacs.d/mysnippets/php-mode/