Add :textobj keyword to map!
This commit is contained in:
parent
76493bd8fc
commit
4fcfec6344
1 changed files with 11 additions and 0 deletions
|
@ -77,6 +77,7 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See
|
||||||
(put ':desc 'lisp-indent-function 'defun)
|
(put ':desc 'lisp-indent-function 'defun)
|
||||||
(put ':leader 'lisp-indent-function 'defun)
|
(put ':leader 'lisp-indent-function 'defun)
|
||||||
(put ':localleader 'lisp-indent-function 'defun)
|
(put ':localleader 'lisp-indent-function 'defun)
|
||||||
|
(put ':textobj 'lisp-indent-function 'defun)
|
||||||
|
|
||||||
(defmacro map! (&rest rest)
|
(defmacro map! (&rest rest)
|
||||||
"A nightmare of a key-binding macro that will use `evil-define-key*',
|
"A nightmare of a key-binding macro that will use `evil-define-key*',
|
||||||
|
@ -106,6 +107,9 @@ States
|
||||||
|
|
||||||
:L cannot be in a :map.
|
: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
|
Flags
|
||||||
(:mode [MODE(s)] [...]) ; inner keybinds are applied to major MODE(s)
|
(:mode [MODE(s)] [...]) ; inner keybinds are applied to major MODE(s)
|
||||||
(:map [KEYMAP(s)] [...]) ; inner keybinds are applied to KEYMAP(S)
|
(:map [KEYMAP(s)] [...]) ; inner keybinds are applied to KEYMAP(S)
|
||||||
|
@ -165,6 +169,13 @@ Example
|
||||||
(setq keymaps
|
(setq keymaps
|
||||||
(mapcar (lambda (m) (intern (format "%s-map" (symbol-name m))))
|
(mapcar (lambda (m) (intern (format "%s-map" (symbol-name m))))
|
||||||
modes))))
|
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
|
(:prefix
|
||||||
(let ((def (pop rest)))
|
(let ((def (pop rest)))
|
||||||
(setq prefix
|
(setq prefix
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue