PRAISE BE TO THE BYTE COMPILER FOR THY SHARP QUOTES
This commit is contained in:
parent
ef88d30b73
commit
5ae94b765c
79 changed files with 798 additions and 795 deletions
|
@ -16,7 +16,7 @@
|
|||
(add-transient-hook! yas-minor-mode-hook (yas-reload-all))
|
||||
|
||||
(add-hook! (text-mode prog-mode snippet-mode)
|
||||
'yas-minor-mode-on)
|
||||
#'yas-minor-mode-on)
|
||||
|
||||
:config
|
||||
(setq yas-verbosity 0
|
||||
|
@ -34,30 +34,30 @@
|
|||
(if (symbol-value mode)
|
||||
(yas-activate-extra-mode mode)
|
||||
(yas-deactivate-extra-mode mode)))
|
||||
(add-hook 'doom-project-hook '+snippets|enable-project-modes)
|
||||
(add-hook 'doom-project-hook #'+snippets|enable-project-modes)
|
||||
|
||||
;; fix an error caused by smartparens interfering with yasnippet bindings
|
||||
(advice-add 'yas-expand :before 'sp-remove-active-pair-overlay)
|
||||
(advice-add #'yas-expand :before #'sp-remove-active-pair-overlay)
|
||||
|
||||
(after! evil
|
||||
(map! (:map yas-keymap
|
||||
"C-e" '+snippets/goto-end-of-field
|
||||
"C-a" '+snippets/goto-start-of-field
|
||||
"<M-right>" '+snippets/goto-end-of-field
|
||||
"<M-left>" '+snippets/goto-start-of-field
|
||||
"<M-backspace>" '+snippets/delete-to-start-of-field
|
||||
[escape] 'evil-normal-state
|
||||
[backspace] '+snippets/delete-backward-char
|
||||
[delete] '+snippets/delete-forward-char-or-field)
|
||||
"C-e" #'+snippets/goto-end-of-field
|
||||
"C-a" #'+snippets/goto-start-of-field
|
||||
"<M-right>" #'+snippets/goto-end-of-field
|
||||
"<M-left>" #'+snippets/goto-start-of-field
|
||||
"<M-backspace>" #'+snippets/delete-to-start-of-field
|
||||
[escape] #'evil-normal-state
|
||||
[backspace] #'+snippets/delete-backward-char
|
||||
[delete] #'+snippets/delete-forward-char-or-field)
|
||||
|
||||
(:map yas-minor-mode-map
|
||||
:i "<tab>" yas-maybe-expand
|
||||
:v "<tab>" '+snippets/expand-on-region))
|
||||
:v "<tab>" #'+snippets/expand-on-region))
|
||||
|
||||
;; Exit snippets on ESC in normal mode
|
||||
(advice-add 'evil-force-normal-state :before 'yas-exit-all-snippets)
|
||||
(advice-add #'evil-force-normal-state :before #'yas-exit-all-snippets)
|
||||
;; Once you're in normal mode, you're out
|
||||
(add-hook 'evil-normal-state-entry-hook 'yas-abort-snippet)
|
||||
(add-hook 'evil-normal-state-entry-hook #'yas-abort-snippet)
|
||||
;; Strip out whitespace before a line selection
|
||||
(defun +snippets|yas-before-expand ()
|
||||
"Strip out the shitespace before a line selection."
|
||||
|
@ -68,19 +68,19 @@
|
|||
"\\(^\\s-*\\|\n? $\\)" ""
|
||||
(buffer-substring-no-properties evil-visual-beginning
|
||||
evil-visual-end)))))
|
||||
(add-hook 'yas-before-expand-snippet-hook '+snippets|yas-before-expand)
|
||||
(add-hook 'yas-before-expand-snippet-hook #'+snippets|yas-before-expand)
|
||||
|
||||
(defun +snippets|yas-after-expand ()
|
||||
"Fix previous hook persisting yas-selected-text between expansions."
|
||||
(setq yas-selected-text nil))
|
||||
(add-hook 'yas-after-exit-snippet-hook '+snippets|yas-after-expand)))
|
||||
(add-hook 'yas-after-exit-snippet-hook #'+snippets|yas-after-expand)))
|
||||
|
||||
|
||||
(def-package! auto-yasnippet
|
||||
:commands (aya-create aya-expand aya-open-line aya-persist-snippet)
|
||||
:init
|
||||
(map! :i [C-tab] 'aya-expand
|
||||
:nv [C-tab] 'aya-create)
|
||||
(map! :i [C-tab] #'aya-expand
|
||||
:nv [C-tab] #'aya-create)
|
||||
:config
|
||||
(setq aya-persist-snippets-dir (concat doom-local-dir "auto-snippets/")))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue