diff options
author | Franck Cuny <franck@fcuny.net> | 2022-06-01 08:24:18 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-06-01 11:19:13 -0700 |
commit | f217a118e336f0cf1f5f49f665aafdb6d66a049d (patch) | |
tree | 1d505a9166df678ab88fa63fcbebb55bb5e42547 | |
parent | ref(Makefile): drop go setup (diff) | |
download | emacs.d-f217a118e336f0cf1f5f49f665aafdb6d66a049d.tar.gz |
fix(yasnippet): add my snippets to default path and enable yas mode
The way I was setting the path for yasnippets was incorrect: the variable `yas-snippets-dir' is expectnig a list of path, not a regular path. I also need to enable yas globally in order to insert them. Change-Id: I437d6fcd8a976d1f42a13707008436dc15547d56 Reviewed-on: https://cl.fcuny.net/c/emacs.d/+/203 Reviewed-by: Franck Cuny <franck@fcuny.net>
Diffstat (limited to '')
-rw-r--r-- | emacs/custom/my-settings.el | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/emacs/custom/my-settings.el b/emacs/custom/my-settings.el index 8062216..5ff81d1 100644 --- a/emacs/custom/my-settings.el +++ b/emacs/custom/my-settings.el @@ -62,11 +62,18 @@ (add-hook 'emacs-startup-hook (lambda () (exec-path-from-shell-initialize)))) (require 'yasnippet) + ;; I want the snippets under `etc' -(setq yas-snippet-dirs (expand-file-name "etc/snippets" user-emacs-directory)) +(defvar my/yasnippets (expand-file-name "etc/snippets" user-emacs-directory)) + +(if (and (file-exists-p my/yasnippets) (not (member my/yasnippets yas-snippet-dirs))) + (add-to-list 'yas-snippet-dirs my/yasnippets)) + ;; the default (tab) conflicts with corfu for completion (define-key yas-minor-mode-map (kbd "C-c y") #'yas-expand) +(yas-global-mode 1) + (provide 'my-settings) ;;; my-settings.el ends here |