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
27
28
29
30
31
32
33
34
|
; Activate yasnippet
; (fingers crossed that it will not break anything like it used to)
(require 'yasnippet)
(yasglobalmode 1)
;; Develop and keep personal snippets under ~/.emacs.d/mysnippets
;; Note: occasionally have to update copiled cache with yasrecompileall
(setq yas/rootdirectory "~/.emacs.d/snippets")
;; Load the snippets
(yas/loaddirectory yas/rootdirectory)
;; TODO these don't work!
;; When writing snippets, go to the next field of the snippet with
;; C-<tab>. This fixes an annoyance where tab completion in
;; autocomplete will not work, and the next field is selected
;; instead.
(setq yas/nextfieldkey "C-,")
(setq yas/prevfieldkey "C-;")
;; If nonnil, yas/nextfieldkey can trigger stacked expansions,
;; that is a snippet expansion inside another snippet
;; expansion. Otherwise, yas/nextfieldkey just tries to move on
;; to the next field.
(setq yas/triggersinfield t)
;; Insert snippets with Cc Ca.
(definekey globalmap (kbd "C-c C-a") 'yasinsertsnippet)
;; Start to fill a snippet with TAB
(setq yas/triggerkey "<tab>")
;; Show snippets in the popup menu autocompletemode uses by default.
(loadfile "~/.emacs.d/yasnippet-popup-isearch-prompt.el")
|