Hacker News new | past | comments | ask | show | jobs | submit login

> Just a simple example is that in xptemplate (and probably any respectable snippet plugin in vim) you can type a part of a snippet name, hit TAB, and it will expand the snippet whose partial name you typed (assuming there's no exact match). In yasnippet, you have to type out the full snippet name before it can be expanded. This is pretty annoying, especially for long snippet names.

Yes, you can do that as well. See the list of expansion methods with screenshots inside: https://capitaomorte.github.io/yasnippet/snippet-expansion.h.... You may interest in minibuffer prompting.

You already have a built-in template system in Emacs called Srecode that allows you to program your templates: http://cedet.sourceforge.net/srecode.shtml

According to the homepage, "the core template text is based loosely on Google ctemplate".




I was hoping someone would say that was possible. Thanks, I'll play around with the available yas-prompt-functions.

As for SRecode, that looks interesting but its documentation is impenetrable. Someone seriously needs to write a bunch of tutorials for that thing. Otherwise, I can't really tell if it can do what xptemplate is capable of or not.

I found some comments from SRecode's author suggesting that it's intended for different uses from yasnippet:

  "Thus, the audience for yasnippet and SRecode is quite different.
  Of course you could do yasnippet like things with SRecode if someone
  took the time to improve the field-editing feature in SRecode, but
  that has not been my focus."[1]
[1] - http://emacs-fu.blogspot.com/2010/09/interview-with-eric-lud...


I agree Srecode needs to improve its documentation. It took me a while to learn to use it by reading the actual templates written that come with CEDET. I may write a tutorial for it at some point. But not now.

You can have a look at a sample template: https://github.com/emacsmirror/cedet/blob/f72ebbc52785013280... . Srt file has syntax highlighting in Emacs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: