2

My init file (.emacs) is version-controlled, my packages are installed with use-package, so my Emacs config is self-contained.

I don't want to add (and manage) specific snippet files into my repository, so I wonder if there is a way to define snippets directly in my init file.

1

1 Answer 1

1

Have you looked at yas-define-snippets?

yas-define-snippets is a compiled Lisp function in ‘yasnippet.el’.

(yas-define-snippets MODE SNIPPETS)

Define SNIPPETS for MODE.

SNIPPETS is a list of snippet definitions, each taking the
following form

 (KEY TEMPLATE NAME CONDITION GROUP EXPAND-ENV LOAD-FILE KEYBINDING UUID SAVE-FILE)

Within these, only KEY and TEMPLATE are actually mandatory.

TEMPLATE might be a Lisp form or a string, depending on whether
this is a snippet or a snippet-command.

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.