💥 Remove :feature category
:feature was a "catch-all" category. Many of its modules fit better in other categories, so they've been moved: - feature/debugger -> tools/debugger - feature/evil -> editor/evil - feature/eval -> tools/eval - feature/lookup -> tools/lookup - feature/snippets -> editor/snippets - feature/file-templates -> editor/file-templates - feature/workspaces -> ui/workspaces More potential changes in the future: - A new :term category for terminal emulation modules (eshell, term and vterm). - A new :os category for modules dedicated to os-specific functionality. The :tools macos module would fit here, but so would modules for nixos and arch. - A new :services category for web-service integration, like wakatime, twitter, elfeed, gist and pastebin services.
This commit is contained in:
parent
52eed893fe
commit
77e4cc4d58
193 changed files with 304 additions and 303 deletions
59
modules/editor/snippets/config.el
Normal file
59
modules/editor/snippets/config.el
Normal file
|
@ -0,0 +1,59 @@
|
|||
;;; editor/snippets/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +snippets-dir (expand-file-name "snippets/" doom-private-dir)
|
||||
"Directory where `yasnippet' will search for your private snippets.")
|
||||
|
||||
|
||||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! yasnippet
|
||||
:commands (yas-minor-mode-on yas-expand yas-expand-snippet yas-lookup-snippet
|
||||
yas-insert-snippet yas-new-snippet yas-visit-snippet-file)
|
||||
:init
|
||||
;; Ensure `yas-reload-all' is called as late as possible. Other modules could
|
||||
;; have additional configuration for yasnippet. For example, file-templates.
|
||||
(add-transient-hook! 'yas-minor-mode-hook (yas-reload-all))
|
||||
|
||||
(add-hook! (text-mode prog-mode conf-mode snippet-mode)
|
||||
#'yas-minor-mode-on)
|
||||
|
||||
:config
|
||||
(setq yas-verbosity (if doom-debug-mode 3 0)
|
||||
yas-also-auto-indent-first-line t
|
||||
yas-triggers-in-field t ; Allow nested snippets
|
||||
;; Remove default ~/.emacs.d/snippets
|
||||
yas-snippet-dirs (delete yas--default-user-snippets-dir yas-snippet-dirs))
|
||||
|
||||
;; Allow private snippets in DOOMDIR/snippets
|
||||
(add-to-list 'yas-snippet-dirs '+snippets-dir nil #'eq)
|
||||
|
||||
;; Remove GUI dropdown prompt (prefer ivy/helm)
|
||||
(setq yas-prompt-functions (delq 'yas-dropdown-prompt yas-prompt-functions))
|
||||
;; Prioritize private snippets in `+snippets-dir' over built-in ones if there
|
||||
;; are multiple choices.
|
||||
(add-to-list 'yas-prompt-functions #'+snippets-prompt-private nil #'eq)
|
||||
|
||||
;; Register `def-project-mode!' modes with yasnippet. This enables project
|
||||
;; specific snippet libraries (e.g. for Laravel, React or Jekyll projects).
|
||||
(add-hook 'doom-project-hook #'+snippets|enable-project-modes)
|
||||
|
||||
;; Exit snippets on ESC from normal mode
|
||||
(add-hook 'doom-escape-hook #'yas-abort-snippet)
|
||||
|
||||
(after! smartparens
|
||||
;; tell smartparens overlays not to interfere with yasnippet keybinds
|
||||
(advice-add #'yas-expand :before #'sp-remove-active-pair-overlay))
|
||||
|
||||
(when (featurep! :editor evil)
|
||||
;; evil visual-mode integration for `yas-insert-snippet'
|
||||
(define-key yas-minor-mode-map [remap yas-insert-snippet] #'+snippets/expand-on-region)))
|
||||
|
||||
|
||||
;; `auto-yasnippet'
|
||||
(setq aya-persist-snippets-dir (concat doom-etc-dir "auto-snippets/"))
|
||||
|
||||
|
||||
;; default snippets library
|
||||
(def-package! emacs-snippets
|
||||
:after yasnippet)
|
Loading…
Add table
Add a link
Reference in a new issue