lang/org: expand snippet on TAB in visual mode

This commit is contained in:
Henrik Lissner 2019-02-19 19:05:49 -05:00
parent bacf4c7a6a
commit b4b85569b4
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -400,12 +400,15 @@ another level of headings on each invocation."
(defun +org|yas-expand-maybe () (defun +org|yas-expand-maybe ()
"Tries to expand a yasnippet snippet, if one is available. Made for "Tries to expand a yasnippet snippet, if one is available. Made for
`org-tab-first-hook'." `org-tab-first-hook'."
(when (and (or (not (bound-and-true-p evil-mode)) (when (bound-and-true-p yas-minor-mode)
(cond ((and (or (not (bound-and-true-p evil-mode))
(eq evil-state 'insert)) (eq evil-state 'insert))
(bound-and-true-p yas-minor-mode)
(yas--templates-for-key-at-point)) (yas--templates-for-key-at-point))
(call-interactively #'yas-expand) (call-interactively #'yas-expand)
t)) t)
((use-region-p)
(call-interactively #'yas-insert-snippet)
t))))
;;;###autoload ;;;###autoload
(defun +org|cycle-only-current-subtree (&optional arg) (defun +org|cycle-only-current-subtree (&optional arg)