feat(snippets): add wip config for tempel to try it out

This commit is contained in:
2022-03-14 21:11:58 +00:00
parent a8618938bf
commit 6bada58d49
4 changed files with 54 additions and 0 deletions

View File

@@ -110,6 +110,7 @@
(require 'siren-sort-words)
(require 'siren-string-edit)
(require 'siren-string-inflection)
(require 'siren-tempel)
(require 'siren-toggle-comments)
(require 'siren-toggle-quotes)
(require 'siren-yasnippet)

View File

@@ -0,0 +1,30 @@
;;; siren-tempel.el --- jimeh's Emacs Siren: tempel configuration.
;;; Commentary:
;; Basic configuration for tempel.
;;; Code:
(use-package tempel
:general
("M-+" 'tempel-complete) ;; Alternative tempel-expand
("M-*" 'tempel-insert)
(:keymaps 'tempel-map
"C-g" 'tempel-done
"TAB" 'tempel-next)
:custom
(tempel-path (expand-file-name "templates" siren-dir))
:hook
(prog-mode . siren-tempel-setup-capf)
(text-mode . siren-tempel-setup-capf)
(lsp-completion-mode . siren-tempel-setup-capf)
:preface
(defun siren-tempel-setup-capf ()
(add-hook 'completion-at-point-functions 'tempel-expand -68 t)))
(provide 'siren-tempel)
;;; siren-tempel.el ends here

View File

@@ -193,6 +193,7 @@
("string-edit.el" . "0e225df6f8740467231c787a50025e4552b3eddb")
("string-inflection" . "fd7926ac17293e9124b31f706a4e8f38f6a9b855")
("tablist" . "faab7a035ef2258cc4ea2182f67e3aedab7e2af9")
("tempel" . "a725dfc5bcd21423ebc108cd4d5d92fb33becded")
("terraform-doc" . "16179e57ce290190c222b27961900657a1981330")
("terraform-mode" . "e560caaa9d9a11b0868adf6d9dcae5ebb5055730")
("themes" . "83fd9545c2823b4b2610947802fa3a52995517b4")

22
templates/default.el Normal file
View File

@@ -0,0 +1,22 @@
go-mode
(tpd "fmt.Println(" p ")")
(tppd "fmt.Printf(\"" (s name) ": %+v\\n\", " (s name) ")")
(tspf "fmt.Sprintf(\"" p "\", " p ")")
(tef "fmt.Errorf(\"" p "\", " p ")")
(ttf "func Test" (p "Name") "(t *testing.T) {" n
" tests := []struct {" n
" name string" n
" " p n
" }{" n
" {" n
" name: \"\"," n
" }," n
" }" n
" for _, tt := range tests {" n
" t.Run(tt.name, func(t *testing.T) {" n
" " n
" })" n
" }" n
"}" n
)