-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support templates by major-mode #1
Comments
Hmm, doing this in a backward-compatible way may be difficult. Using two It could be something like |
Right now I just have Doom's template system copied in my config file. I'd like to switch to something that's actually packaged, but the functionality of yatemplate seems limited by comparison. For example, Doom's template system supports this: (setq doom-+file-templates-alist
`((,(rx ".org" eol)
:when noct-blog-dir-p
:trigger "__post"
:mode org-mode)
(emacs-lisp-mode :trigger "__package"))) Going entirely by file naming seems too basic to handle more complex cases. |
I've ultimately decided that doing this in file names is probably a bad idea to begin with. It makes it much more likely that my emacs config will fail on some more exotic filesystems (or, i don't know, an OS that uses The code for doing it with just
The only slight annoyance is that it feels like the template names are duplicating information, which is why I used yasnippet in the first place. I think ideally |
Doom doesn't use autoinsert at all; it uses
Yeah, it would be nice if yasnippet just had this functionality built in. I would package an alternative myself, but I don't really want to maintain it. I'll just keep the code in my config for now. |
See #32 for a possible solution |
Very cool! Hope it lands, last I looked upstream wasn't really accepting PRs because they're working on a more-or-less full rework of the codebase that in turn has stalled. Maybe I'll switch to your branch in the mean time :) |
auto-insert-mode
can define insertions by major mode (in addition to regex matching the filename). It would be great ifyatemplate
also supported this. Perhaps something-like:To define a snippet for
c++-mode
.The text was updated successfully, but these errors were encountered: