doomemacs/modules/editor/snippets
theschmocker 4643376268 fix(snippets): fix +snippets/new and +snippets/new-alias file creation
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.
2023-08-19 21:49:11 -05:00
..
autoload fix(snippets): fix +snippets/new and +snippets/new-alias file creation 2023-08-19 21:49:11 -05:00
config.el refactor: deprecate doom-private-dir for doom-user-dir 2022-08-14 20:43:35 +02:00
packages.el bump: :editor 2023-02-21 19:34:42 -05:00
README.org docs: change link format 2022-10-05 01:01:19 +02:00

:editor snippets

Description   unfold

This module adds snippet expansions to Emacs, powered by doom-package:yasnippet.

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?