I'm struggling a bit with yasnippet. My question must be very basic but I would like to modify some snippets but I can't locate them. I have for example a snippet style for html-mode but it does not appear where it should be that is either under :




My config is the following:

(add-to-list 'load-path
(require 'yasnippet)
(yas-global-mode 1)
(add-to-list 'yas-snippet-dirs "~/.emacs.d/snippets")

Any would be appreciated!


4 Answers 4


Considering your configuration, using elpa, they are located in ~/.emacs.d/elpa/yasnippet-20160801.1142/snippets.

Your custom snippets should be at ~/.emacs.d/snippets so they don't get overwritten in each update. Also check the value of the variable yas-snippets-dirs with Ctr-h v yas-snippets-dir.


In your buffer, M-x yas-visit-snippet-file, then type the name of the snippet you want to edit, or choose from a prompted list. Then it will open a buffer for you to edit. From the buffer you can M-: buffer-file-name to see the path of the file containing the snippet.


If you want to edit a snippet from the mode you are in just press the standard commands :

C-c & C-v to view an existing snippet (you should know what name it has)


C-c & C-n to create a new snippet for the mode you're in.

In this way you don't have to care about where the snippets are located, YASnippet should do that automatically.

You can also open existing/new snippets by clicking on the menu bar YASnippet (if you're using the GUI).

I hope this could help you.


Try (setq yas-snippet-dirs '("~/.emacs.d/snippets"))

When you miss a snippet, that you've already created, use yas-reload-all.

And you don't need the first line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.