init-autoinsert.el 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ;; -*- lexical-binding: t -*-
  2. (defun my/yas-org-snippet ()
  3. (interactive)
  4. (yas-expand-snippet (yas-lookup-snippet "<org-mode"))
  5. (evil-insert-state))
  6. (defun my/yas-elisp-init-files-snippet ()
  7. (interactive)
  8. (yas-expand-snippet (yas-lookup-snippet "<elisp-init-files"))
  9. (evil-insert-state))
  10. (defun my/yas-c-mode-snippet ()
  11. (interactive)
  12. (yas-expand-snippet (yas-lookup-snippet "<c-mode"))
  13. (evil-insert-state))
  14. (defun my/cover-letter-file-snippet ()
  15. (interactive)
  16. (yas-expand-snippet (yas-lookup-snippet "<cover-letter"))
  17. (evil-insert-state))
  18. (defun my/blog-entry-file-snippet ()
  19. (interactive)
  20. (yas-expand-snippet (yas-lookup-snippet "<blog-entry"))
  21. (evil-insert-state))
  22. (defun my/yas-web-mode-snippet ()
  23. (interactive)
  24. (yas-expand-snippet (yas-lookup-snippet "<web-mode"))
  25. (evil-insert-state))
  26. ;;(use-package autoinsert)
  27. (add-hook 'find-file-hook 'auto-insert)
  28. (setq auto-insert-directory "~/.config/emacs/auto-insert-directory/")
  29. (setq auto-insert-mode t
  30. auto-insert-query t)
  31. (setq auto-insert-alist '((web-mode . [my/yas-web-mode-snippet])
  32. (c-mode . [my/yas-c-mode-snippet])
  33. (org-mode . [my/yas-org-snippet])))
  34. (add-to-list 'auto-insert-alist '((".*/lisp/.*\\.org$") . [my/yas-elisp-init-files-snippet]))
  35. (add-to-list 'auto-insert-alist '((".*/cover-letters.*\\.org$") . [my/cover-letter-file-snippet]))
  36. (add-to-list 'auto-insert-alist '((".*/my-wordpress-blog.*\\.org$") . [my/blog-entry-file-snippet]))
  37. (provide 'init-autoinsert)