Files
.emacs.d/lisp/init-snippet.el

46 lines
1.4 KiB
EmacsLisp
Raw Permalink Normal View History

2026-02-27 22:07:54 +11:00
;; -*- lexical-binding: t; -*-
;; Yasnippet settings
(use-package yasnippet
:diminish
2026-04-02 19:21:30 +11:00
:hook (elpaca-after-init . yas-global-mode)
:hook ((post-self-insert . my/yas-try-expanding-auto-snippets))
2026-04-03 19:00:38 +11:00
:commands (yas-minor-mode-on
yas-expand
yas-expand-snippet
yas-lookup-snippet
yas-insert-snippet
yas-new-snippet
yas-visit-snippet-file
yas-activate-extra-mode
yas-deactivate-extra-mode
yas-maybe-expand-abbrev-key-filter)
:init
(defvar yas-verbosity 2)
2026-02-27 22:07:54 +11:00
:config
2026-03-29 19:12:45 +11:00
(elemacs-load-packages-incrementally '(eldoc easymenu help-mode))
2026-02-27 22:07:54 +11:00
(use-package warnings
2026-04-02 19:21:30 +11:00
:ensure nil
2026-02-27 22:07:54 +11:00
: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-04-03 19:00:38 +11:00
(use-package doom-snippets
:after yasnippet
:ensure (doom-snippets :type git :host github :repo "doomemacs/snippets" :files ("*.el" "*")))
2026-03-22 23:57:48 +11:00
2026-02-27 22:07:54 +11:00
(provide 'init-snippet)