1

In yasnippet's manual expansion of snippet inside a snippet is mentioned but I wasn't able to achieve this. Can someone tell me what I'm doing wrong ?

I have two snippets :

# -*- mode: snippet -*-
# name: newhist
# key: newhist
# expand-env: ((yas-triggers-in-field 't))
# --
${1:-- }----------------------------------------------------------------------------
${2:_head}$2
$1Objet        : ${4:Objet}$0

and

# -*- mode: snippet -*-
# name: _head
# key: _head
# --
${1:-- }Auteur       : `(and (boundp 'user-ngram) user-ngram)`
$1Date         : `(capitalize (format-time-string "%d/%m/%Y"))`
$1Version      : `(and (boundp 'global-release) global-release)`.00.${2:0001}$0

And I expect something like that after expansion :

-- ----------------------------------------------------------------------------
-- Auteur       : me
-- Date         : 29/09/2016
-- Version      : 513.00.0001
-- Objet        : Objet

But all I get is :

-- ----------------------------------------------------------------------------
_head_head
-- Objet        : Objet
4

you need to add this to your yasnippet config in .emacs to enable nested triggering of snippets

(setq yas-triggers-in-field t)

  • I try to do that but it doesn't work. – Pierre Téchoueyres Sep 30 '16 at 10:17
  • 1
    @Pierre You have to move point to the end of _head and then press TAB. – npostavs Sep 30 '16 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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