diff options
| author | James Nguyen <james@jojojames.com> | 2021-01-31 20:51:39 -0800 |
|---|---|---|
| committer | James N <james@jojojames.com> | 2021-02-03 21:08:35 -0800 |
| commit | e52dfbeb68225beb4e0eabb60a052f5748db8244 (patch) | |
| tree | 70379adbc11bbc3a75f050ee95df9fe63d35ef6d /modes/pass | |
| parent | c02184f2fc7e6fce83f92f05b6f27b11b9f04d6e (diff) | |
Add evil-collection-define-operator-key
This is for attaching additional keys to operator commands.
e.g. Add "f" to prefix/operator (evil-yank) "y" to get
"yf"
while still maintaining the other operator commands like "yy".
Diffstat (limited to 'modes/pass')
| -rw-r--r-- | modes/pass/evil-collection-pass.el | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/modes/pass/evil-collection-pass.el b/modes/pass/evil-collection-pass.el index eab592d..5e5551b 100644 --- a/modes/pass/evil-collection-pass.el +++ b/modes/pass/evil-collection-pass.el @@ -66,42 +66,10 @@ keybindings listed in `evil-collection-pass-command-to-label'." (advice-add 'pass--display-keybinding :around 'evil-collection-pass-display-keybinding) - ;; FIXME: #1 This type of binding is duplicated throughout `evil-collection' - ;; Maybe define new utility to do these types of bindings that append - ;; to (e.g. y or d) operators. - ;; FIXME: #2 These types of bindings will slip through the white/blacklist. - ;; For example a user may want to set a blacklist for a bind like "yf" - ;; but these binds would be registered as "f" in this case. - ;; FIXME: #3 Handle [remap evil-yank], etc to be more bulletproof. - ;; https://github.com/emacs-evil/evil-collection/pull/91#issuecomment-366181047 - (evil-collection-define-key 'operator 'pass-mode-map - ;; Like `eww'. - "f" '(menu-item - "" - nil - :filter (lambda (&optional _) - (when (memq evil-this-operator - evil-collection-yank-operators) - (setq evil-inhibit-operator t) - 'pass-copy-field))) - - "n" '(menu-item - "" - nil - :filter (lambda (&optional _) - (when (memq evil-this-operator - evil-collection-yank-operators) - (setq evil-inhibit-operator t) - 'pass-copy-username))) - - "u" '(menu-item - "" - nil - :filter (lambda (&optional _) - (when (memq evil-this-operator - evil-collection-yank-operators) - (setq evil-inhibit-operator t) - 'pass-copy-url)))) + (evil-collection-define-operator-key 'yank 'pass-mode-map + "f" 'pass-copy-field + "n" 'pass-copy-username + "u" 'pass-copy-url) ;; https://github.com/NicolasPetton/pass/pull/47 (when (fboundp 'pass-edit) |
