$ cat "

Quick Tip: Configuring Yasnippet to Inherit Snippets from Another Mode


To share common snippets between similar emacs modes i have the following yasnippet directory setup:


I then place all shared snippets in the text-mode folder which enables me to use them from the child modes. If you add a new mode for which you do not have any specific snippets, but you still want that mode to inherit snippets from the parent mode, simply create an empty child directory. This will let yasnippet know that you consider the new mode a child mode of the mode with the shared snippets.

As a side note, if you have your configuration committed to a git repository, the empty directory will not be added to the repository, since Git really only cares about files. To remedy this, add a dummy file to the directory, for example a file called .keep, or something similar.

Written by Erik Öjebo 2016-06-16 09:02