2026-02-27 22:07:54 +11:00
|
|
|
;; -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
|
|
;; Yasnippet settings
|
|
|
|
|
(use-package yasnippet
|
|
|
|
|
:diminish
|
|
|
|
|
:ensure t
|
|
|
|
|
:hook (elpaca-after-init . yas-global-mode)
|
|
|
|
|
:hook ((LaTeX-mode . yas-minor-mode)
|
|
|
|
|
(post-self-insert . my/yas-try-expanding-auto-snippets))
|
|
|
|
|
:config
|
|
|
|
|
(use-package warnings
|
|
|
|
|
:ensure nil
|
|
|
|
|
:config
|
|
|
|
|
(cl-pushnew '(yasnippet backquote-change)
|
|
|
|
|
warning-suppress-types
|
|
|
|
|
:test 'equal))
|
|
|
|
|
|
|
|
|
|
(setq yas-triggers-in-field t)
|
2026-02-28 01:36:39 +11:00
|
|
|
|
|
|
|
|
;; Snippets trigger inside a word
|
2026-02-27 22:07:54 +11:00
|
|
|
(setq yas-key-syntaxes (list #'yas-longest-key-from-whitespace "w_.()" "w_." "w_" "w"))
|
2026-03-22 23:57:48 +11:00
|
|
|
|
2026-02-27 22:07:54 +11:00
|
|
|
;; Function that tries to autoexpand YaSnippets
|
|
|
|
|
;; The double quoting is NOT a typo!
|
|
|
|
|
(defun my/yas-try-expanding-auto-snippets ()
|
|
|
|
|
(when (and (boundp 'yas-minor-mode) yas-minor-mode)
|
|
|
|
|
(let ((yas-buffer-local-condition ''(require-snippet-condition . auto)))
|
|
|
|
|
(yas-expand)))))
|
|
|
|
|
|
2026-03-22 23:57:48 +11:00
|
|
|
;; Collection of yasnippet snippets
|
|
|
|
|
(use-package yasnippet-snippets)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-27 22:07:54 +11:00
|
|
|
(provide 'init-snippet)
|