doomemacs/modules/editor/file-templates
Henrik Lissner 77e4cc4d58
💥 Remove :feature category
:feature was a "catch-all" category. Many of its modules fit better in
other categories, so they've been moved:

- feature/debugger -> tools/debugger
- feature/evil -> editor/evil
- feature/eval -> tools/eval
- feature/lookup -> tools/lookup
- feature/snippets -> editor/snippets
- feature/file-templates -> editor/file-templates
- feature/workspaces -> ui/workspaces

More potential changes in the future:

- A new :term category for terminal emulation modules (eshell, term and
  vterm).
- A new :os category for modules dedicated to os-specific functionality.
  The :tools macos module would fit here, but so would modules for nixos
  and arch.
- A new :services category for web-service integration, like wakatime,
  twitter, elfeed, gist and pastebin services.
2019-04-24 18:16:04 -04:00
..
templates
autoload.el
config.el
packages.el
README.org

editor/file-templates

Description

This module adds file templates for blank files, powered by yasnippet.

Module Flags

This module provides no flags.

Plugins

This module installs no plugins.

Prerequisites

This module has no prerequisites.

Usage

File templates are automatically expanded when opening empty files.

They are also regular yasnippet snippets, which can be expanded by typing their trigger and pressing TAB. By convention, the triggers for file templates are prefixed with two underscores __.

Inserting OSS licenses

A special command is available for inserting software licenses: M-x +file-templates/insert-license.

Licenses with a -bp suffix are boilerplate templates; shorter versions meant for comment headers in code.

Configuration

TODO Registering a new file template

TODO Changing existing file templates

Adding new OSS licenses

The +file-templates/insert-license command searches for snippets under text-mode that are named __license-ABC, where ABC is the short name of the license. e.g. __license-mit.

So long as these files exist, +file-templates/insert-license will recognize them.

Troubleshooting

If a file template isn't expanding where you expect it to, run M-x +file-templates/debug. This will report to you what file template rule would apply for the correct file.

Appendix

API

  • set-file-template! PRED &rest PLIST
  • set-file-templates! &rest TEMPLATES

Commands

  • +file-templates/insert-license
  • +file-templates/debug

Variables

  • +file-templates-dir
  • +file-templates-default-trigger
  • +file-templates-alist