When adding a snippet/alias to a mode for the first time, setting `default-directory` before calling `+snippet--ensure-dir` would cause an error due to the directory not existing. As a fix, return the dir from `+snippet--ensure-dir` and bind `default-directory` to that. Additionally, not having a file associated with the buffer caused issues with loading the snippet after using snippet-mode's C-c C-c binding, especially when other directories were added to yasnippet's load paths. As a solution for this, prompt the user for a snippet key and set the buffer's file name to it within the snippet dir. If an existing file would be overwritten, ask user for confirmation. As an additional convenience, set the snippet's key field to the entered value. Finally, replace %alias with doom-snippets-expand in the generated alias snippets. Not aware of any history here, but %alias did not work for me. |
||
---|---|---|
.. | ||
autoload | ||
config.el | ||
packages.el | ||
README.org |
:editor snippets
Description unfold
This module adds snippet expansions to Emacs, powered by doom-package:yasnippet.
Maintainers
Module flags
This module exposes no flags.
TODO Hacks
🔨 This module's hacks haven't been documented yet. Document them?
TODO Changelog
This module does not have a changelog yet.
Installation
Enable this module in your doom!
block.
This module has no external requirements.
TODO Usage
🔨 This module has no usage documentation yet. Write some?
TODO Configuration
🔨 This module's configuration documentation is incomplete. Complete it?
Disabling the built-in snippets
;; in $DOOMDIR/packages.el
(package! doom-snippets :ignore t)
;; If you want to replace it with yasnippet's default snippets
(package! yasnippet-snippets)
Adding custom snippets
Custom snippets should be added under $DOOMDIR/snippets/
directory. Refer to yasnippet-documentation on how to write snippets.
Troubleshooting
There are no known problems with this module. Report one?
Frequently asked questions
This module has no FAQs yet. Ask one?
TODO Appendix
🔨 This module has no appendix yet. Write one?