Improve YASnippet configuration
This commit is contained in:
parent
6b8ed24b0c
commit
b87c387302
1 changed files with 19 additions and 1 deletions
20
init.el
20
init.el
|
@ -158,8 +158,26 @@
|
|||
|
||||
(use-package yasnippet
|
||||
:ensure t
|
||||
:diminish yas-minor-mode
|
||||
:init
|
||||
(use-package yasnippet-snippets :ensure t :after yasnippet)
|
||||
:hook ((prog-mode LaTeX-mode org-mode) . yas-minor-mode)
|
||||
:bind
|
||||
(:map yas-minor-mode-map ("C-c C-n" . yas-expand-from-trigger-key))
|
||||
(:map yas-keymap
|
||||
(("TAB" . smarter-yas-expand-next-field)
|
||||
([(tab)] . smarter-yas-expand-next-field)))
|
||||
:config
|
||||
(yas-global-mode 1))
|
||||
(yas-reload-all)
|
||||
(defun smarter-yas-expand-next-field ()
|
||||
"Try to `yas-expand' then `yas-next-field' at current cursor position."
|
||||
(interactive)
|
||||
(let ((old-point (point))
|
||||
(old-tick (buffer-chars-modified-tick)))
|
||||
(yas-expand)
|
||||
(when (and (eq old-point (point))
|
||||
(eq old-tick (buffer-chars-modified-tick)))
|
||||
(ignore-errors (yas-next-field))))))
|
||||
|
||||
(use-package flycheck
|
||||
:ensure t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue