summaryrefslogtreecommitdiffstats
path: root/lisp/bandali-yasnippet.el
blob: 6cdbc7a867c6eddd1397bff3ee06f6bb99eebb17 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(use-package yasnippet
  :defer 0.6
  :config
  (declare-function yas-reload-all
                    "yasnippet" (&optional no-jit interactive))
  (declare-function yas-maybe-expand-abbrev-key-filter
                    "yasnippet" (cmd))

  (defconst yas-verbosity-cur yas-verbosity)
  (setq yas-verbosity 2)
  (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
  (yas-reload-all)
  (setq yas-verbosity yas-verbosity-cur)

  (defun b/yas-maybe-expand-abbrev-key-filter (cmd)
    (when (and (yas-maybe-expand-abbrev-key-filter cmd)
               (not (bound-and-true-p git-commit-mode)))
      cmd))
  (defconst b/yas-maybe-expand
    '(menu-item "" yas-expand :filter b/yas-maybe-expand-abbrev-key-filter))
  (define-key yas-minor-mode-map
    (kbd "SPC") b/yas-maybe-expand)

  (yas-global-mode))

(provide 'bandali-yasnippet)