parent
1ad283f5b7
commit
de0b62b604
|
@ -1,6 +1,6 @@
|
|||
;;; evil-collection.el --- A set of keybindings for Evil mode -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2017 James Nguyen
|
||||
;; Copyright (C) 2017, 2023 James Nguyen
|
||||
|
||||
;; Author: James Nguyen <james@jojojames.com>
|
||||
;; Pierre Neidhardt <mail@ambrevar.xyz>
|
||||
|
@ -437,10 +437,10 @@ functions added to this hook should include a \"&rest _rest\" for forward
|
|||
compatibility.")
|
||||
|
||||
(defun evil-collection-define-operator-key (operator map-sym &rest bindings)
|
||||
"Defines a key on a specific operator e.g. yank or delete.
|
||||
"Define a key on a specific OPERATOR e.g. yank or delete.
|
||||
|
||||
This function is useful for adding specific binds to operator maps
|
||||
(e.g. `evil-yank' or `evil-delete') without erasing the original bind.
|
||||
\(e.g. `evil-yank' or `evil-delete') without erasing the original bind.
|
||||
|
||||
For example, say one wants to bind \"yf\" to something but also wants to keep
|
||||
\"yy\".
|
||||
|
@ -449,7 +449,7 @@ This function takes care of checking the whitelist/blacklist against the full
|
|||
binding.
|
||||
|
||||
For example:
|
||||
(evil-collection-define-operator-key \='yank
|
||||
\(evil-collection-define-operator-key \='yank
|
||||
\='pass-mode-map \"f\" \='pass-copy-field)
|
||||
|
||||
This will check \"yf\" against a user's white/blacklist and also record the
|
||||
|
@ -498,8 +498,8 @@ binding in `annalist' as so."
|
|||
(defun evil-collection--filter-states (state)
|
||||
"Return a list states after filtering STATE (a single symbol or list of symbols).
|
||||
The return value adheres to `evil-collection-state-passlist' and
|
||||
`evil-collection-state-denylist'. When the STATE is `nil', which
|
||||
means all states for `evil-define-key', return `nil'."
|
||||
`evil-collection-state-denylist'. When the STATE is nil, which
|
||||
means all states for `evil-define-key', return nil."
|
||||
(let ((states (if (listp state) state (list state))))
|
||||
(seq-difference
|
||||
(if evil-collection-state-passlist
|
||||
|
@ -707,16 +707,16 @@ invocation."
|
|||
(dolist (mode-symbol modes)
|
||||
(let ((keymap-symbol (intern (format "%S-map" mode-symbol))))
|
||||
(dolist (state states)
|
||||
(evil-delay `(and (boundp ',keymap-symbol)
|
||||
(evil-with-delay `(and (boundp ',keymap-symbol)
|
||||
(keymapp ,keymap-symbol))
|
||||
`(evil-collection--translate-minor-mode-key
|
||||
',state
|
||||
',mode-symbol
|
||||
',translations
|
||||
,destructive)
|
||||
'after-load-functions t nil
|
||||
(symbol-name (cl-gensym (format "evil-collection-translate-key-in-%s"
|
||||
keymap-symbol))))))))
|
||||
`(after-load-functions
|
||||
t
|
||||
nil
|
||||
(symbol-name
|
||||
(cl-gensym
|
||||
(format "evil-collection-translate-key-in-%s" ,keymap-symbol))))
|
||||
(evil-collection--translate-minor-mode-key state mode-symbol
|
||||
translations destructive))))))
|
||||
|
||||
(defun evil-collection--translate-minor-mode-key (state
|
||||
mode-symbol
|
||||
|
@ -812,13 +812,16 @@ invocation."
|
|||
(setq states (list states)))
|
||||
(dolist (keymap-symbol keymaps)
|
||||
(dolist (state states)
|
||||
(evil-delay `(and (boundp ',keymap-symbol)
|
||||
(evil-with-delay `(and (boundp ',keymap-symbol)
|
||||
(keymapp ,keymap-symbol))
|
||||
`(evil-collection--translate-key ',state ',keymap-symbol
|
||||
',translations ,destructive)
|
||||
'after-load-functions t nil
|
||||
(symbol-name (cl-gensym (format "evil-collection-translate-key-in-%s"
|
||||
keymap-symbol)))))))
|
||||
`(after-load-functions
|
||||
t
|
||||
nil
|
||||
(symbol-name
|
||||
(cl-gensym
|
||||
(format "evil-collection-translate-key-in-%s" ,keymap-symbol))))
|
||||
(evil-collection--translate-key state keymap-symbol
|
||||
translations destructive)))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro evil-collection-swap-key (states keymaps &rest args)
|
||||
|
@ -839,7 +842,7 @@ should consist of key swaps (e.g. \"a\" \"b\" is equivalent to \"a\" \"b\" \"b\"
|
|||
"Wrapper around `evil-collection-translate-minor-mode-key' for swapping keys.
|
||||
STATES, MODES, and ARGS are passed to
|
||||
`evil-collection-translate-minor-mode-key'. ARGS should consist of key swaps
|
||||
(e.g. \"a\" \"b\" is equivalent to \"a\" \"b\" \"b\" \"a\"
|
||||
\(e.g. \"a\" \"b\" is equivalent to \"a\" \"b\" \"b\" \"a\"
|
||||
with `evil-collection-translate-minor-mode-key') and optionally keyword
|
||||
arguments for `evil-collection-translate-minor-mode-key'."
|
||||
(declare (indent defun))
|
||||
|
|
Loading…
Reference in New Issue