diff --git a/core/core-keybinds.el b/core/core-keybinds.el index 29b2ab06c..205667d10 100644 --- a/core/core-keybinds.el +++ b/core/core-keybinds.el @@ -77,6 +77,7 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See (put ':desc 'lisp-indent-function 'defun) (put ':leader 'lisp-indent-function 'defun) (put ':localleader 'lisp-indent-function 'defun) +(put ':textobj 'lisp-indent-function 'defun) (defmacro map! (&rest rest) "A nightmare of a key-binding macro that will use `evil-define-key*', @@ -106,6 +107,9 @@ States :L cannot be in a :map. + :textobj is a special state that takes a key and two commands, one for the + inner binding, another for the outer. + Flags (:mode [MODE(s)] [...]) ; inner keybinds are applied to major MODE(s) (:map [KEYMAP(s)] [...]) ; inner keybinds are applied to KEYMAP(S) @@ -165,6 +169,13 @@ Example (setq keymaps (mapcar (lambda (m) (intern (format "%s-map" (symbol-name m)))) modes)))) + (:textobj + (let* ((key (pop rest)) + (inner (pop rest)) + (outer (pop rest))) + (push (macroexpand `(map! (:map evil-outer-text-objects-map ,key ,inner) + (:map evil-inner-text-objects-map ,key ,outer))) + forms))) (:prefix (let ((def (pop rest))) (setq prefix