Fix unindexed file-templates on first load of yasnippet

This commit is contained in:
Henrik Lissner 2017-10-23 20:07:54 +02:00
parent 13cf6b3fb6
commit a24a3ef292
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 4 additions and 4 deletions

View file

@ -11,13 +11,12 @@
:init :init
(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)

View file

@ -11,6 +11,8 @@
(defvar yas-minor-mode-map (make-sparse-keymap)) (defvar yas-minor-mode-map (make-sparse-keymap))
:init :init
(setq yas-snippet-dirs '(yas-installed-snippets-dir))
;; Ensure `yas-reload-all' is called as late as possible. Other modules could ;; Ensure `yas-reload-all' is called as late as possible. Other modules could
;; have additional configuration for yasnippet. For example, file-templates. ;; have additional configuration for yasnippet. For example, file-templates.
(add-transient-hook! 'yas-minor-mode-hook (yas-reload-all)) (add-transient-hook! 'yas-minor-mode-hook (yas-reload-all))
@ -23,7 +25,6 @@
yas-indent-line 'auto yas-indent-line 'auto
yas-also-auto-indent-first-line t yas-also-auto-indent-first-line t
yas-prompt-functions '(yas-completing-prompt yas-ido-prompt yas-no-prompt) yas-prompt-functions '(yas-completing-prompt yas-ido-prompt yas-no-prompt)
yas-snippet-dirs '(yas-installed-snippets-dir)
yas-use-menu nil yas-use-menu nil
;; Allow nested snippets ;; Allow nested snippets
yas-triggers-in-field t) yas-triggers-in-field t)