fix(yasnippet): C-d clears field; ensure insert state on expand
This commit is contained in:
15
config.el
15
config.el
@@ -1260,6 +1260,21 @@ Otherwise: runs interactive ement-connect, then opens rooms after sync."
|
||||
;; TAB in Evil insert: with yasnippet-capf first in CAPF list,
|
||||
;; corfu shows snippets as expandable items — no manual TAB override needed.
|
||||
;; Standard indent-for-tab-command handles org-cycle / indent fallback.
|
||||
|
||||
;; Evil + yasnippet: when entering a field, select default text so typing replaces it.
|
||||
;; Without this, default text is not visually selected in Evil insert state.
|
||||
(add-hook 'yas-before-expand-snippet-hook
|
||||
(lambda () (when (evil-normal-state-p) (evil-insert-state))))
|
||||
|
||||
;; Delete field content with a single key: C-d clears current field content
|
||||
(add-hook 'yas-keymap-disable-hook
|
||||
(lambda () (not (yas--snippets-at-point))))
|
||||
|
||||
(define-key yas-keymap (kbd "C-d")
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(delete-region (yas-field-start (yas-current-field))
|
||||
(yas-field-end (yas-current-field)))))
|
||||
)
|
||||
|
||||
;;; ============================================================
|
||||
|
||||
Reference in New Issue
Block a user