From f217a118e336f0cf1f5f49f665aafdb6d66a049d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 1 Jun 2022 08:24:18 -0700 Subject: 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 --- emacs/custom/my-settings.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'emacs/custom') 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 -- cgit 1.4.1