Add :textobj keyword to map!

This commit is contained in:
Henrik Lissner 2017-05-28 00:55:08 +02:00
parent 76493bd8fc
commit 4fcfec6344

View file

@ -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