2

I would like to replicate some of the snippets shown in this blog post

Some of the snippets shown in that post involved if statements that check for regexp in snippet fields as well as checking for regex before a snippet

Can yasnippets do the same? If yes, then how?

I did not see anything like that in the documentaion

1

Yasnippets can execute arbitrary lisp code writing it inside back quotes

In your case you can write something like

`(if (re-search-forward "regex" nil t)
     "some text"
   "another one")`

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.