feature/file-templates: minor refactor

This commit is contained in:
Henrik Lissner 2017-09-24 17:05:42 +02:00
parent 5ff9849b39
commit be2f0a043d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -4,7 +4,7 @@
(defvar +file-templates-dir (defvar +file-templates-dir
(expand-file-name "templates/" (file-name-directory load-file-name)) (expand-file-name "templates/" (file-name-directory load-file-name))
"") "The path to a directory of yasnippet folders to use for file templates.")
(def-package! autoinsert ; built-in (def-package! autoinsert ; built-in
:defer 1 :defer 1
@ -12,12 +12,12 @@
(setq auto-insert-query nil ; Don't prompt before insertion (setq auto-insert-query nil ; Don't prompt before insertion
auto-insert-alist nil) ; Tabula rasa auto-insert-alist nil) ; Tabula rasa
(after! yasnippet
(push '+file-templates-dir yas-snippet-dirs))
:config :config
(auto-insert-mode 1) (auto-insert-mode 1)
(after! yasnippet
(push '+file-templates-dir yas-snippet-dirs))
(defun +file-templates--expand (key &optional mode project-only) (defun +file-templates--expand (key &optional mode project-only)
"Auto insert a snippet of yasnippet into new file." "Auto insert a snippet of yasnippet into new file."
(when (if project-only (doom-project-p) t) (when (if project-only (doom-project-p) t)