Add key translation functionality
Also add evil-collection-setup-hook. Fixes #5 and #98.
This commit is contained in:
parent
488b3d8fe7
commit
1853b53a8d
|
@ -31,6 +31,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'evil-collection-evil-search)
|
(require 'evil-collection-evil-search)
|
||||||
|
|
||||||
|
(defconst evil-collection-ag-maps '(ag-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-ag-setup ()
|
(defun evil-collection-ag-setup ()
|
||||||
"Set up `evil' bindings for `ag'."
|
"Set up `evil' bindings for `ag'."
|
||||||
(evil-define-key '(normal visual) ag-mode-map
|
(evil-define-key '(normal visual) ag-mode-map
|
||||||
|
|
|
@ -30,6 +30,17 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'alchemist nil t)
|
(require 'alchemist nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-alchemist-maps '(alchemist-compile-mode-map
|
||||||
|
alchemist-eval-mode-map
|
||||||
|
alchemist-execute-mode-map
|
||||||
|
alchemist-message-mode-map
|
||||||
|
alchemist-help-minor-mode-map
|
||||||
|
alchemist-macroexpand-mode-map
|
||||||
|
alchemist-mix-mode-map
|
||||||
|
alchemist-test-report-mode-map
|
||||||
|
alchemist-mode-map))
|
||||||
|
|
||||||
|
|
||||||
(defun evil-collection-alchemist-setup ()
|
(defun evil-collection-alchemist-setup ()
|
||||||
"Set up `evil' bindings for `alchemist'."
|
"Set up `evil' bindings for `alchemist'."
|
||||||
(evil-set-initial-state 'alchemist-compile-mode 'normal)
|
(evil-set-initial-state 'alchemist-compile-mode 'normal)
|
||||||
|
|
|
@ -29,6 +29,9 @@
|
||||||
(require 'anaconda-mode nil t)
|
(require 'anaconda-mode nil t)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-anaconda-mode-maps '(anaconda-mode-view-mode-map
|
||||||
|
anaconda-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-anaconda-mode-setup ()
|
(defun evil-collection-anaconda-mode-setup ()
|
||||||
"Set up `evil' bindings for `anaconda-mode'."
|
"Set up `evil' bindings for `anaconda-mode'."
|
||||||
;; Bindings don't seem to be set the first time.
|
;; Bindings don't seem to be set the first time.
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'arc-mode)
|
(require 'arc-mode)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-arc-mode-maps '(archive-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-arc-mode-setup ()
|
(defun evil-collection-arc-mode-setup ()
|
||||||
"Set up `evil' bindings for `arc-mode'."
|
"Set up `evil' bindings for `arc-mode'."
|
||||||
(evil-set-initial-state 'arc-mode 'normal)
|
(evil-set-initial-state 'arc-mode 'normal)
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'bookmark)
|
(require 'bookmark)
|
||||||
|
|
||||||
|
(defconst evil-collection-bookmark-maps '(bookmark-bmenu-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-bookmark-setup ()
|
(defun evil-collection-bookmark-setup ()
|
||||||
"Set up `evil' bindings for `bookmark'."
|
"Set up `evil' bindings for `bookmark'."
|
||||||
(evil-set-initial-state 'bookmark-bmenu-mode 'normal)
|
(evil-set-initial-state 'bookmark-bmenu-mode 'normal)
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'tabulated-list)
|
(require 'tabulated-list)
|
||||||
|
|
||||||
|
(defconst evil-collection-buff-menu-maps '(Buffer-menu-mode-map))
|
||||||
|
|
||||||
;; This is for `evil-collection-Buffer-menu-unmark-all-buffers.'
|
;; This is for `evil-collection-Buffer-menu-unmark-all-buffers.'
|
||||||
(defsubst evil-collection-buff-menu-tabulated-list-header-overlay-p (&optional pos)
|
(defsubst evil-collection-buff-menu-tabulated-list-header-overlay-p (&optional pos)
|
||||||
"Return non-nil if there is a fake header.
|
"Return non-nil if there is a fake header.
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
(require 'evil-collection-util)
|
(require 'evil-collection-util)
|
||||||
(require 'calc)
|
(require 'calc)
|
||||||
|
|
||||||
|
(defconst evil-collection-calc-maps '(calc-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-calc-ext-setup ()
|
(defun evil-collection-calc-ext-setup ()
|
||||||
"Set up `evil' bindings for `calc'.
|
"Set up `evil' bindings for `calc'.
|
||||||
Since calc bindings are set on-demand when calc-ext is load, we
|
Since calc bindings are set on-demand when calc-ext is load, we
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'calendar)
|
(require 'calendar)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-calendar-maps '(calendar-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-calendar-setup ()
|
(defun evil-collection-calendar-setup ()
|
||||||
"Set up `evil' bindings for `calendar'."
|
"Set up `evil' bindings for `calendar'."
|
||||||
(evil-set-initial-state 'calendar-mode 'normal)
|
(evil-set-initial-state 'calendar-mode 'normal)
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
|
|
||||||
(declare-function cider-debug-mode-send-reply "cider-debug")
|
(declare-function cider-debug-mode-send-reply "cider-debug")
|
||||||
|
|
||||||
|
(defconst evil-collection-cider-maps '(cider-mode-map
|
||||||
|
cider-repl-mode-map
|
||||||
|
cider-test-report-mode-map
|
||||||
|
cider-macroexpansion-mode-map
|
||||||
|
cider-connections-buffer-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-cider-last-sexp (command &rest args)
|
(defun evil-collection-cider-last-sexp (command &rest args)
|
||||||
"In normal-state or motion-state, last sexp ends at point."
|
"In normal-state or motion-state, last sexp ends at point."
|
||||||
(if (and (not evil-move-beyond-eol)
|
(if (and (not evil-move-beyond-eol)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'comint)
|
(require 'comint)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-comint-maps '(comint-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-comint-setup ()
|
(defun evil-collection-comint-setup ()
|
||||||
"Set up `evil' bindings for `comint'."
|
"Set up `evil' bindings for `comint'."
|
||||||
(when evil-want-C-d-scroll
|
(when evil-want-C-d-scroll
|
||||||
|
|
|
@ -50,6 +50,8 @@ be set through custom or before evil-collection loads."
|
||||||
(defvar company-active-map)
|
(defvar company-active-map)
|
||||||
(defvar company-search-map)
|
(defvar company-search-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-company-maps '(company-active-map company-search-map))
|
||||||
|
|
||||||
(defun evil-collection-company-setup ()
|
(defun evil-collection-company-setup ()
|
||||||
"Set up `evil' bindings for `company'."
|
"Set up `evil' bindings for `company'."
|
||||||
(define-key company-active-map (kbd "C-n") 'company-select-next-or-abort)
|
(define-key company-active-map (kbd "C-n") 'company-select-next-or-abort)
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
(require 'compile)
|
(require 'compile)
|
||||||
(require 'evil-collection-evil-search)
|
(require 'evil-collection-evil-search)
|
||||||
|
|
||||||
|
(defconst evil-collection-compile-maps '(compilation-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-compile-setup ()
|
(defun evil-collection-compile-setup ()
|
||||||
"Set up `evil' bindings for `compile'."
|
"Set up `evil' bindings for `compile'."
|
||||||
(evil-set-initial-state 'compilation-mode 'normal)
|
(evil-set-initial-state 'compilation-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
(require 'cus-theme)
|
(require 'cus-theme)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-cus-theme-maps '(custom-theme-choose-mode-map
|
||||||
|
custom-new-theme-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-cus-theme-setup ()
|
(defun evil-collection-cus-theme-setup ()
|
||||||
"Set up `evil' bindings for `cus-theme'."
|
"Set up `evil' bindings for `cus-theme'."
|
||||||
(evil-set-initial-state 'custom-new-theme-mode 'normal)
|
(evil-set-initial-state 'custom-new-theme-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'cus-edit)
|
(require 'cus-edit)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-custom-maps '(custom-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-custom-setup ()
|
(defun evil-collection-custom-setup ()
|
||||||
"Set up `evil' bindings for `Custom-mode'."
|
"Set up `evil' bindings for `Custom-mode'."
|
||||||
(evil-set-initial-state 'Custom-mode 'normal)
|
(evil-set-initial-state 'Custom-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
(require 'daemons nil t)
|
(require 'daemons nil t)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-daemons-maps '(daemons-mode-map
|
||||||
|
daemons-output-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-daemons-setup ()
|
(defun evil-collection-daemons-setup ()
|
||||||
"Set up `evil' bindings for `daemons'."
|
"Set up `evil' bindings for `daemons'."
|
||||||
(evil-define-key '(normal visual) daemons-mode-map
|
(evil-define-key '(normal visual) daemons-mode-map
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'debbugs nil t)
|
(require 'debbugs nil t)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-debbugs-maps '(debbugs-gnu-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-debbugs-setup ()
|
(defun evil-collection-debbugs-setup ()
|
||||||
"Set up `evil' bindings for `debbugs-gnu-mode'."
|
"Set up `evil' bindings for `debbugs-gnu-mode'."
|
||||||
(evil-set-initial-state 'debbugs-gnu-mode 'normal)
|
(evil-set-initial-state 'debbugs-gnu-mode 'normal)
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'debug)
|
(require 'debug)
|
||||||
|
|
||||||
|
(defconst evil-collection-debug-maps '(debugger-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-debug-setup ()
|
(defun evil-collection-debug-setup ()
|
||||||
"Set up `evil' bindings for `debug'."
|
"Set up `evil' bindings for `debug'."
|
||||||
(evil-set-initial-state 'debugger-mode 'normal)
|
(evil-set-initial-state 'debugger-mode 'normal)
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'diff-mode)
|
(require 'diff-mode)
|
||||||
|
|
||||||
|
(defconst evil-collection-diff-mode-maps '(diff-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-diff-read-only-state-switch ()
|
(defun evil-collection-diff-read-only-state-switch ()
|
||||||
"Make read-only in motion state, writable in normal state."
|
"Make read-only in motion state, writable in normal state."
|
||||||
(if buffer-read-only
|
(if buffer-read-only
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'dired)
|
(require 'dired)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-dired-maps '(dired-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-dired-setup ()
|
(defun evil-collection-dired-setup ()
|
||||||
"Set up `evil' bindings for `dired'."
|
"Set up `evil' bindings for `dired'."
|
||||||
(evil-define-key 'normal dired-mode-map
|
(evil-define-key 'normal dired-mode-map
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'doc-view)
|
(require 'doc-view)
|
||||||
|
|
||||||
|
(defconst evil-collection-doc-view-maps '(doc-view-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-doc-view-setup ()
|
(defun evil-collection-doc-view-setup ()
|
||||||
"Set up `evil' bindings for `doc-view'."
|
"Set up `evil' bindings for `doc-view'."
|
||||||
(evil-set-initial-state 'doc-view-mode 'normal)
|
(evil-set-initial-state 'doc-view-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,11 @@
|
||||||
(require 'edebug)
|
(require 'edebug)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-edebug-maps
|
||||||
|
'(edebug-mode-map
|
||||||
|
edebug-x-instrumented-function-list-mode-map
|
||||||
|
edebug-x-breakpoint-list-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-edebug-setup ()
|
(defun evil-collection-edebug-setup ()
|
||||||
"Set up `evil' bindings for `edebug'."
|
"Set up `evil' bindings for `edebug'."
|
||||||
(evil-set-initial-state 'edebug-mode 'normal)
|
(evil-set-initial-state 'edebug-mode 'normal)
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
(defvar elfeed-search-mode-map)
|
(defvar elfeed-search-mode-map)
|
||||||
(defvar elfeed-show-mode-map)
|
(defvar elfeed-show-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-elfeed-maps '(elfeed-search-mode-map
|
||||||
|
elfeed-show-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-elfeed-setup ()
|
(defun evil-collection-elfeed-setup ()
|
||||||
"Set up `evil' bindings for `elfeed'."
|
"Set up `evil' bindings for `elfeed'."
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'elisp-mode)
|
(require 'elisp-mode)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-elisp-mode-maps nil)
|
||||||
|
|
||||||
(defun evil-collection-elisp-mode-last-sexp-setup-props (beg end value alt1 alt2)
|
(defun evil-collection-elisp-mode-last-sexp-setup-props (beg end value alt1 alt2)
|
||||||
"Set up text properties for the output of `elisp--eval-last-sexp'.
|
"Set up text properties for the output of `elisp--eval-last-sexp'.
|
||||||
BEG and END are the start and end of the output in current-buffer.
|
BEG and END are the start and end of the output in current-buffer.
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'elisp-refs nil t)
|
(require 'elisp-refs nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-elisp-refs-maps '(elisp-refs-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-elisp-refs-setup ()
|
(defun evil-collection-elisp-refs-setup ()
|
||||||
"Set up `evil' bindings for `elisp-refs'."
|
"Set up `evil' bindings for `elisp-refs'."
|
||||||
(evil-define-key 'normal elisp-refs-mode-map
|
(evil-define-key 'normal elisp-refs-mode-map
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
(defvar emms-browser-mode-map)
|
(defvar emms-browser-mode-map)
|
||||||
(defvar emms-playlist-mode-map)
|
(defvar emms-playlist-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-emms-maps '(emms-browser-mode-map
|
||||||
|
emms-playlist-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-emms-playlist-mode-insert-newline-above ()
|
(defun evil-collection-emms-playlist-mode-insert-newline-above ()
|
||||||
"Insert a newline above point."
|
"Insert a newline above point."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'epa nil t)
|
(require 'epa nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-epa-maps '(epa-key-list-mode-map
|
||||||
|
epa-key-mode-map
|
||||||
|
epa-info-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-epa-setup ()
|
(defun evil-collection-epa-setup ()
|
||||||
(evil-define-key 'normal epa-key-list-mode-map
|
(evil-define-key 'normal epa-key-list-mode-map
|
||||||
(kbd "<tab>") 'widget-forward
|
(kbd "<tab>") 'widget-forward
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
(require 'eshell)
|
(require 'eshell)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-eshell-maps '(eshell-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-eshell-next-prompt ()
|
(defun evil-collection-eshell-next-prompt ()
|
||||||
"`evil' wrapper around `eshell-next-prompt'."
|
"`evil' wrapper around `eshell-next-prompt'."
|
||||||
(when (get-text-property (point) 'read-only)
|
(when (get-text-property (point) 'read-only)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'eval-sexp-fu nil t)
|
(require 'eval-sexp-fu nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-eval-sexp-fu-maps nil)
|
||||||
|
|
||||||
(defun evil-collection-eval-sexp-fu-bounds-of-thing-at-point-sexp (command &rest args)
|
(defun evil-collection-eval-sexp-fu-bounds-of-thing-at-point-sexp (command &rest args)
|
||||||
"In normal-state or motion-state, last sexp ends at point."
|
"In normal-state or motion-state, last sexp ends at point."
|
||||||
(if (and (eq (nth 0 args) 'sexp)
|
(if (and (eq (nth 0 args) 'sexp)
|
||||||
|
|
|
@ -30,6 +30,11 @@
|
||||||
(require 'eww)
|
(require 'eww)
|
||||||
(require 'evil-collection-util)
|
(require 'evil-collection-util)
|
||||||
|
|
||||||
|
(defvar evil-collection-eww-maps '(eww-mode-map
|
||||||
|
eww-history-mode-map
|
||||||
|
eww-buffers-mode-map
|
||||||
|
eww-bookmark-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-eww-setup ()
|
(defun evil-collection-eww-setup ()
|
||||||
"Set up `evil' bindings for `eww'."
|
"Set up `evil' bindings for `eww'."
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
(defvar flycheck-error-list-mode-map)
|
(defvar flycheck-error-list-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-flycheck-maps '(flycheck-error-list-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-flycheck-setup ()
|
(defun evil-collection-flycheck-setup ()
|
||||||
"Set up `evil' bindings for `flycheck'."
|
"Set up `evil' bindings for `flycheck'."
|
||||||
(evil-set-initial-state 'flycheck-error-list-mode 'normal)
|
(evil-set-initial-state 'flycheck-error-list-mode 'normal)
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(defvar free-keys-mode-map)
|
(defvar free-keys-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-free-keys-maps '(free-keys-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-free-keys-set-header-line-format ()
|
(defun evil-collection-free-keys-set-header-line-format ()
|
||||||
"Tweak `header-line-format' locally for `free-keys'."
|
"Tweak `header-line-format' locally for `free-keys'."
|
||||||
(setq-local header-line-format
|
(setq-local header-line-format
|
||||||
|
|
|
@ -33,6 +33,11 @@
|
||||||
(defvar geiser-debug-mode-map)
|
(defvar geiser-debug-mode-map)
|
||||||
(defvar geiser-doc-mode-map)
|
(defvar geiser-doc-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-geiser-maps '(geiser-debug-mode-map
|
||||||
|
geiser-doc-mode-map
|
||||||
|
geiser-repl-mode-map
|
||||||
|
geiser-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-geiser-last-sexp (command &rest args)
|
(defun evil-collection-geiser-last-sexp (command &rest args)
|
||||||
"In normal-state or motion-state, last sexp ends at point."
|
"In normal-state or motion-state, last sexp ends at point."
|
||||||
(if (and (not evil-move-beyond-eol)
|
(if (and (not evil-move-beyond-eol)
|
||||||
|
|
|
@ -36,6 +36,11 @@
|
||||||
(defvar ggtags-view-tag-history-mode-map)
|
(defvar ggtags-view-tag-history-mode-map)
|
||||||
(defvar ggtags-navigation-map)
|
(defvar ggtags-navigation-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-ggtags-maps '(ggtags-mode-map
|
||||||
|
ggtags-view-search-history-mode-map
|
||||||
|
ggtags-view-tag-history-mode-map
|
||||||
|
ggtags-navigation-map))
|
||||||
|
|
||||||
(defun evil-collection-ggtags-setup ()
|
(defun evil-collection-ggtags-setup ()
|
||||||
"Set up `evil' bindings for `ggtags'."
|
"Set up `evil' bindings for `ggtags'."
|
||||||
(evil-set-initial-state 'ggtags-global-mode 'normal)
|
(evil-set-initial-state 'ggtags-global-mode 'normal)
|
||||||
|
|
|
@ -24,11 +24,15 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Bindings for `go-mode'.
|
;; Bindings for `go-mode'.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'go-mode nil t)
|
(require 'go-mode nil t)
|
||||||
|
|
||||||
;;; Code:
|
(defconst evil-collection-go-mode-maps '(go-mode-map
|
||||||
|
godoc-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-go-mode-setup ()
|
(defun evil-collection-go-mode-setup ()
|
||||||
"Set up `evil' bindings for `go-mode'."
|
"Set up `evil' bindings for `go-mode'."
|
||||||
(evil-define-key 'normal go-mode-map
|
(evil-define-key 'normal go-mode-map
|
||||||
|
|
|
@ -48,6 +48,14 @@
|
||||||
|
|
||||||
(declare-function helm-window "helm-lib")
|
(declare-function helm-window "helm-lib")
|
||||||
|
|
||||||
|
(defconst evil-collection-helm-maps '(help-map
|
||||||
|
help-find-files-map
|
||||||
|
helm-read-file-map
|
||||||
|
helm-generic-files-map
|
||||||
|
helm-buffer-map
|
||||||
|
helm-moccur-map
|
||||||
|
helm-grep-map))
|
||||||
|
|
||||||
;; From https://github.com/emacs-helm/helm/issues/362.
|
;; From https://github.com/emacs-helm/helm/issues/362.
|
||||||
;; Also see https://emacs.stackexchange.com/questions/17058/change-cursor-type-in-helm-header-line#17097.
|
;; Also see https://emacs.stackexchange.com/questions/17058/change-cursor-type-in-helm-header-line#17097.
|
||||||
;; TODO: With Evil, the cursor type is not right in the header line and the evil
|
;; TODO: With Evil, the cursor type is not right in the header line and the evil
|
||||||
|
@ -113,6 +121,7 @@
|
||||||
header-line-format)
|
header-line-format)
|
||||||
(when update (force-mode-line-update)))))))
|
(when update (force-mode-line-update)))))))
|
||||||
|
|
||||||
|
|
||||||
(defun evil-collection-helm-setup ()
|
(defun evil-collection-helm-setup ()
|
||||||
"Set up `evil' bindings for `helm'."
|
"Set up `evil' bindings for `helm'."
|
||||||
(add-hook 'helm-minibuffer-set-up-hook 'evil-collection-helm-hide-minibuffer-maybe)
|
(add-hook 'helm-minibuffer-set-up-hook 'evil-collection-helm-hide-minibuffer-maybe)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'help-mode)
|
(require 'help-mode)
|
||||||
|
|
||||||
|
(defconst evil-collection-help-maps '(help-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-help-setup ()
|
(defun evil-collection-help-setup ()
|
||||||
"Set up `evil' bindings for `help'."
|
"Set up `evil' bindings for `help'."
|
||||||
(evil-set-initial-state 'help-mode 'normal)
|
(evil-set-initial-state 'help-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'ibuffer)
|
(require 'ibuffer)
|
||||||
|
|
||||||
|
(defconst evil-collection-ibuffer-maps '(ibuffer-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-ibuffer-setup ()
|
(defun evil-collection-ibuffer-setup ()
|
||||||
"Set up `evil' bindings for `ibuffer'."
|
"Set up `evil' bindings for `ibuffer'."
|
||||||
(evil-set-initial-state 'ibuffer-mode 'normal)
|
(evil-set-initial-state 'ibuffer-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'image+ nil t)
|
(require 'image+ nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-image+-maps '(image-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-image+-setup ()
|
(defun evil-collection-image+-setup ()
|
||||||
"Set up `evil' bindings for `image+'."
|
"Set up `evil' bindings for `image+'."
|
||||||
(evil-define-key 'normal image-mode-map
|
(evil-define-key 'normal image-mode-map
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
;; TODO: pdf and doc-view conflict with image.
|
;; TODO: pdf and doc-view conflict with image.
|
||||||
;; See https://github.com/emacs-evil/evil-collection/issues/23.
|
;; See https://github.com/emacs-evil/evil-collection/issues/23.
|
||||||
|
|
||||||
|
(defconst evil-collection-image-maps '(image-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-image-setup ()
|
(defun evil-collection-image-setup ()
|
||||||
"Set up `evil' bindings for `image-mode'."
|
"Set up `evil' bindings for `image-mode'."
|
||||||
(evil-set-initial-state 'image-mode 'normal)
|
(evil-set-initial-state 'image-mode 'normal)
|
||||||
|
|
|
@ -24,12 +24,19 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Bindings for `indium'.
|
;; Bindings for `indium'.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'evil-collection-settings)
|
(require 'evil-collection-settings)
|
||||||
(require 'indium nil t)
|
(require 'indium nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-indium-maps '(indium-debugger-mode-map
|
||||||
|
indium-inspector-mode-map
|
||||||
|
indium-debugger-locals-mode-map
|
||||||
|
indium-debugger-frames-mode-map
|
||||||
|
indium-interaction-mode-map
|
||||||
|
indium-repl-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-indium-setup ()
|
(defun evil-collection-indium-setup ()
|
||||||
"Set up `evil' bindings for `indium'."
|
"Set up `evil' bindings for `indium'."
|
||||||
(when evil-collection-settings-setup-debugger-keys
|
(when evil-collection-settings-setup-debugger-keys
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
(require 'evil-collection-evil-search)
|
(require 'evil-collection-evil-search)
|
||||||
(require 'info)
|
(require 'info)
|
||||||
|
|
||||||
|
(defconst evil-collection-info-maps '(Info-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-info-setup ()
|
(defun evil-collection-info-setup ()
|
||||||
"Set up `evil' bindings for `info-mode'."
|
"Set up `evil' bindings for `info-mode'."
|
||||||
(evil-collection-util-inhibit-insert-state Info-mode-map)
|
(evil-collection-util-inhibit-insert-state Info-mode-map)
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'ivy nil t)
|
(require 'ivy nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-ivy-maps '(ivy-occur-mode-map
|
||||||
|
ivy-occur-grep-mode-map
|
||||||
|
ivy-minibuffer-map))
|
||||||
|
|
||||||
(defun evil-collection-ivy-setup ()
|
(defun evil-collection-ivy-setup ()
|
||||||
"Set up `evil' bindings for `ivy-mode'."
|
"Set up `evil' bindings for `ivy-mode'."
|
||||||
(evil-define-key 'normal ivy-occur-mode-map
|
(evil-define-key 'normal ivy-occur-mode-map
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'kotlin-mode nil t)
|
(require 'kotlin-mode nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-kotlin-maps '(kotlin-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-kotlin-mode-setup ()
|
(defun evil-collection-kotlin-mode-setup ()
|
||||||
"Set up `evil' bindings for `kotlin-mode'."
|
"Set up `evil' bindings for `kotlin-mode'."
|
||||||
(evil-define-key 'normal kotlin-mode-map "gz" 'kotlin-repl))
|
(evil-define-key 'normal kotlin-mode-map "gz" 'kotlin-repl))
|
||||||
|
|
|
@ -24,11 +24,14 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Bindings for `log-view'
|
;; Bindings for `log-view'.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'log-view)
|
(require 'log-view)
|
||||||
|
|
||||||
;;; Code:
|
(defconst evil-collection-log-view-maps '(log-view-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-log-view-setup ()
|
(defun evil-collection-log-view-setup ()
|
||||||
"Set up `evil' bindings for `log-view'."
|
"Set up `evil' bindings for `log-view'."
|
||||||
(evil-define-key 'normal log-view-mode-map
|
(evil-define-key 'normal log-view-mode-map
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
(defvar lua-indent-level)
|
(defvar lua-indent-level)
|
||||||
|
|
||||||
|
(defconst evil-collection-lua-mode-maps '(lua-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-lua-mode-set-evil-shift-width ()
|
(defun evil-collection-lua-mode-set-evil-shift-width ()
|
||||||
"Set `evil-shift-width' according to `lua-indent-level'."
|
"Set `evil-shift-width' according to `lua-indent-level'."
|
||||||
(setq evil-shift-width lua-indent-level))
|
(setq evil-shift-width lua-indent-level))
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'macrostep nil t)
|
(require 'macrostep nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-macrostep-maps '(macrostep-keymap))
|
||||||
|
|
||||||
(defun evil-collection-macrostep-setup ()
|
(defun evil-collection-macrostep-setup ()
|
||||||
"Set up `evil' bindings for `macrostep'."
|
"Set up `evil' bindings for `macrostep'."
|
||||||
;; Keymaps don't seem to be populated on first try.
|
;; Keymaps don't seem to be populated on first try.
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'man)
|
(require 'man)
|
||||||
|
|
||||||
|
(defconst evil-collection-man-maps '(Man-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-man-setup ()
|
(defun evil-collection-man-setup ()
|
||||||
"Set up `evil' bindings for `man'."
|
"Set up `evil' bindings for `man'."
|
||||||
(evil-set-initial-state 'Man-mode 'normal)
|
(evil-set-initial-state 'Man-mode 'normal)
|
||||||
|
|
|
@ -29,6 +29,13 @@
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-minibuffer-maps '(minibuffer-local-map
|
||||||
|
minibuffer-local-ns-map
|
||||||
|
minibuffer-local-completion-map
|
||||||
|
minibuffer-local-must-match-map
|
||||||
|
minibuffer-local-isearch-map
|
||||||
|
evil-ex-completion-map))
|
||||||
|
|
||||||
(defun evil-collection-minibuffer-insert ()
|
(defun evil-collection-minibuffer-insert ()
|
||||||
"Switch to insert state.
|
"Switch to insert state.
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'neotree nil t)
|
(require 'neotree nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-neotree-maps '(neotree-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-neotree-setup ()
|
(defun evil-collection-neotree-setup ()
|
||||||
"Set up `evil' bindings for `neotree'."
|
"Set up `evil' bindings for `neotree'."
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,13 @@
|
||||||
(declare-function notmuch-search-tag "notmuch")
|
(declare-function notmuch-search-tag "notmuch")
|
||||||
(declare-function notmuch-tree-tag "notmuch-tree")
|
(declare-function notmuch-tree-tag "notmuch-tree")
|
||||||
|
|
||||||
|
(defconst evil-collection-notmuch-maps '(notmuch-common-keymap
|
||||||
|
notmuch-hello-mode-map
|
||||||
|
notmuch-show-mode-map
|
||||||
|
notmuch-tree-mode-map
|
||||||
|
notmuch-search-mode-map
|
||||||
|
notmuch-search-stash-map))
|
||||||
|
|
||||||
(defun evil-collection-notmuch-show-toggle-delete ()
|
(defun evil-collection-notmuch-show-toggle-delete ()
|
||||||
"Toggle deleted tag for message."
|
"Toggle deleted tag for message."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
(require 'nov nil t)
|
(require 'nov nil t)
|
||||||
|
|
||||||
(defvar nov-mode-map)
|
(defvar nov-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-nov-maps '(nov-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-nov-setup ()
|
(defun evil-collection-nov-setup ()
|
||||||
"Set up `evil' bindings for `nov'."
|
"Set up `evil' bindings for `nov'."
|
||||||
(evil-define-key 'normal nov-mode-map
|
(evil-define-key 'normal nov-mode-map
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
(when (> emacs-major-version 25)
|
(when (> emacs-major-version 25)
|
||||||
(require 'replace))
|
(require 'replace))
|
||||||
|
|
||||||
|
(defconst evil-collection-occur-maps '(occur-mode-map
|
||||||
|
occur-edit-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-occur-setup ()
|
(defun evil-collection-occur-setup ()
|
||||||
"Set up `evil' bindings for `occur'."
|
"Set up `evil' bindings for `occur'."
|
||||||
(evil-set-initial-state 'occur-mode 'normal)
|
(evil-set-initial-state 'occur-mode 'normal)
|
||||||
|
|
|
@ -40,6 +40,8 @@ mode."
|
||||||
:group 'evil-collection-outline
|
:group 'evil-collection-outline
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
|
(defconst evil-collection-outline-maps '(outline-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-outline-setup ()
|
(defun evil-collection-outline-setup ()
|
||||||
"Set up `evil' bindings for `outline'."
|
"Set up `evil' bindings for `outline'."
|
||||||
(evil-set-initial-state 'outline-mode 'normal)
|
(evil-set-initial-state 'outline-mode 'normal)
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
(defvar p4-basic-mode-map)
|
(defvar p4-basic-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-p4-maps '(p4-basic-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-p4-setup ()
|
(defun evil-collection-p4-setup ()
|
||||||
"Set up `evil' bindings for `p4'."
|
"Set up `evil' bindings for `p4'."
|
||||||
(evil-set-initial-state 'p4-basic-mode 'normal)
|
(evil-set-initial-state 'p4-basic-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'package)
|
(require 'package)
|
||||||
|
|
||||||
|
(defconst evil-collection-package-menu-maps '(package-menu-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-package-menu-setup ()
|
(defun evil-collection-package-menu-setup ()
|
||||||
"Set up `evil' bindings for `package-menu'."
|
"Set up `evil' bindings for `package-menu'."
|
||||||
(evil-set-initial-state 'package-menu-mode 'normal)
|
(evil-set-initial-state 'package-menu-mode 'normal)
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
(defvar pass-mode-map)
|
(defvar pass-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-pass-maps '(pass-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-pass-setup ()
|
(defun evil-collection-pass-setup ()
|
||||||
"Set up `evil' bindings for `pass-mode'."
|
"Set up `evil' bindings for `pass-mode'."
|
||||||
(evil-define-key 'normal pass-mode-map
|
(evil-define-key 'normal pass-mode-map
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
(require 'pdf-tools nil t)
|
(require 'pdf-tools nil t)
|
||||||
(require 'pdf-view nil t)
|
(require 'pdf-view nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-pdf-maps '(pdf-view-mode-map
|
||||||
|
pdf-outline-buffer-mode-map
|
||||||
|
pdf-occur-buffer-mode-map))
|
||||||
|
|
||||||
(declare-function pdf-view-last-page "pdf-view")
|
(declare-function pdf-view-last-page "pdf-view")
|
||||||
(declare-function pdf-view-first-page "pdf-view")
|
(declare-function pdf-view-first-page "pdf-view")
|
||||||
(declare-function pdf-view-goto-page "pdf-view")
|
(declare-function pdf-view-goto-page "pdf-view")
|
||||||
|
|
|
@ -24,11 +24,14 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Bindings for `popup'.
|
;; Bindings for `popup'.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'popup nil t)
|
(require 'popup nil t)
|
||||||
|
|
||||||
;;; Code:
|
(defconst evil-collection-popup-maps '(popup-menu-keymap))
|
||||||
|
|
||||||
(defun evil-collection-popup-setup ()
|
(defun evil-collection-popup-setup ()
|
||||||
"Set up `evil' bindings for `popup'."
|
"Set up `evil' bindings for `popup'."
|
||||||
(defvar popup-menu-keymap)
|
(defvar popup-menu-keymap)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil-collection-util)
|
(require 'evil-collection-util)
|
||||||
(require 'proced)
|
(require 'proced)
|
||||||
|
|
||||||
|
(defconst evil-collection-proced-maps '(proced-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-proced-setup ()
|
(defun evil-collection-proced-setup ()
|
||||||
"Set up `evil' bindings for `proced'."
|
"Set up `evil' bindings for `proced'."
|
||||||
(evil-collection-util-inhibit-insert-state proced-mode-map)
|
(evil-collection-util-inhibit-insert-state proced-mode-map)
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'prodigy nil t)
|
(require 'prodigy nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-prodigy-maps '(prodigy-mode-map
|
||||||
|
prodigy-view-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-prodigy-setup ()
|
(defun evil-collection-prodigy-setup ()
|
||||||
"Set up `evil' bindings for `prodigy'."
|
"Set up `evil' bindings for `prodigy'."
|
||||||
(evil-define-key 'normal prodigy-mode-map
|
(evil-define-key 'normal prodigy-mode-map
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'profiler)
|
(require 'profiler)
|
||||||
|
|
||||||
|
(defconst evil-collection-profiler-maps '(profiler-report-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-profiler-setup ()
|
(defun evil-collection-profiler-setup ()
|
||||||
"Set up `evil' bindings for `profiler'."
|
"Set up `evil' bindings for `profiler'."
|
||||||
(evil-set-initial-state 'profiler-report-mode 'normal)
|
(evil-set-initial-state 'profiler-report-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'python)
|
(require 'python)
|
||||||
|
|
||||||
|
(defconst evil-collection-python-maps '(python-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-python-set-evil-shift-width ()
|
(defun evil-collection-python-set-evil-shift-width ()
|
||||||
"Set `evil-shift-width' according to `python-indent-offset'."
|
"Set `evil-shift-width' according to `python-indent-offset'."
|
||||||
(setq evil-shift-width python-indent-offset))
|
(setq evil-shift-width python-indent-offset))
|
||||||
|
|
|
@ -24,11 +24,14 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Bindings for `quickrun'.
|
;; Bindings for `quickrun'.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'quickrun nil t)
|
(require 'quickrun nil t)
|
||||||
|
|
||||||
;;; Code:
|
(defconst evil-collection-quickrun-maps '(quickrun--mode-map))
|
||||||
|
|
||||||
(defun evil-collection-quickrun-setup ()
|
(defun evil-collection-quickrun-setup ()
|
||||||
"Set up `evil' bindings for `quickrun'.."
|
"Set up `evil' bindings for `quickrun'.."
|
||||||
(evil-define-key 'normal quickrun--mode-map
|
(evil-define-key 'normal quickrun--mode-map
|
||||||
|
|
|
@ -24,12 +24,15 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Bindings for `racer'.
|
;; Bindings for `racer'.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'racer nil t)
|
(require 'racer nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-racer-maps '(racer-mode-map
|
||||||
|
racer-help-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-racer-setup ()
|
(defun evil-collection-racer-setup ()
|
||||||
"Set up `evil' bindings for `racer'."
|
"Set up `evil' bindings for `racer'."
|
||||||
(evil-define-key 'normal racer-mode-map
|
(evil-define-key 'normal racer-mode-map
|
||||||
|
|
|
@ -24,11 +24,14 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Bindings for `realgud'.
|
;; Bindings for `realgud'.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'realgud nil t)
|
(require 'realgud nil t)
|
||||||
|
|
||||||
;;; Code:
|
(defconst evil-collection-realgud-maps '(realgud:shortkey-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-realgud-setup ()
|
(defun evil-collection-realgud-setup ()
|
||||||
"Set up `evil' bindings for `realgud'."
|
"Set up `evil' bindings for `realgud'."
|
||||||
;; This one is to represent `realgud-populate-src-buffer-map-plain'.
|
;; This one is to represent `realgud-populate-src-buffer-map-plain'.
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
(require 'reftex-ref nil t)
|
(require 'reftex-ref nil t)
|
||||||
(require 'reftex-cite nil t)
|
(require 'reftex-cite nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-reftex-maps '(reftex-select-shared-map
|
||||||
|
reftex-toc-mode-map))
|
||||||
|
|
||||||
;; original code can be found in reftex-ref.el
|
;; original code can be found in reftex-ref.el
|
||||||
(setq reftex-select-label-prompt
|
(setq reftex-select-label-prompt
|
||||||
"Select: [RET]select [j]next [k]previous [gr]escan [go]context [q]uit [g?]help")
|
"Select: [RET]select [j]next [k]previous [gr]escan [go]context [q]uit [g?]help")
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
(defvar rjsx-mode-map)
|
(defvar rjsx-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-rjsx-maps '(rjsx-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-rjsx-mode-setup ()
|
(defun evil-collection-rjsx-mode-setup ()
|
||||||
"Set up `evil' bindings for `rjsx-mode'."
|
"Set up `evil' bindings for `rjsx-mode'."
|
||||||
(when evil-want-C-d-scroll
|
(when evil-want-C-d-scroll
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'robe nil t)
|
(require 'robe nil t)
|
||||||
|
|
||||||
|
(defconst evil-collection-robe-maps '(robe-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-robe-setup ()
|
(defun evil-collection-robe-setup ()
|
||||||
"Set up `evil' bindings for `robe'."
|
"Set up `evil' bindings for `robe'."
|
||||||
(evil-define-key 'normal robe-mode-map
|
(evil-define-key 'normal robe-mode-map
|
||||||
|
|
|
@ -35,6 +35,11 @@
|
||||||
(defvar rtags-references-tree-mode-map)
|
(defvar rtags-references-tree-mode-map)
|
||||||
(defvar rtags-location-stack-visualize-mode-map)
|
(defvar rtags-location-stack-visualize-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-rtags-maps '(rtags-mode-map
|
||||||
|
rtags-dependency-tree-mode-map
|
||||||
|
rtags-references-tree-mode-map
|
||||||
|
rtags-location-stack-visualize-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-rtags-setup ()
|
(defun evil-collection-rtags-setup ()
|
||||||
"Set up `evil' bindings for `rtags'."
|
"Set up `evil' bindings for `rtags'."
|
||||||
(evil-set-initial-state 'rtags-mode 'normal)
|
(evil-set-initial-state 'rtags-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'ruby-mode)
|
(require 'ruby-mode)
|
||||||
|
|
||||||
|
(defconst evil-collection-ruby-mode-maps nil)
|
||||||
|
|
||||||
(defun evil-collection-ruby-mode-set-evil-shift-width ()
|
(defun evil-collection-ruby-mode-set-evil-shift-width ()
|
||||||
"Set `evil-shift-width' according to `ruby-indent-level'."
|
"Set `evil-shift-width' according to `ruby-indent-level'."
|
||||||
(setq evil-shift-width ruby-indent-level))
|
(setq evil-shift-width ruby-indent-level))
|
||||||
|
|
|
@ -24,14 +24,16 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Bindings for `simple'
|
;; Bindings for `simple'
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'simple)
|
(require 'simple)
|
||||||
|
|
||||||
(defvar special-mode-map)
|
(defvar special-mode-map)
|
||||||
|
|
||||||
;;; Code:
|
(defconst evil-collection-simple-maps '(special-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-simple-setup ()
|
(defun evil-collection-simple-setup ()
|
||||||
"Set up `evil' bindings for `simple'."
|
"Set up `evil' bindings for `simple'."
|
||||||
(evil-define-key '(normal visual) special-mode-map
|
(evil-define-key '(normal visual) special-mode-map
|
||||||
|
|
|
@ -37,6 +37,13 @@
|
||||||
(defvar slime-popup-buffer-mode-map)
|
(defvar slime-popup-buffer-mode-map)
|
||||||
(defvar slime-xref-mode-map)
|
(defvar slime-xref-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-slime-maps '(slime-parent-map
|
||||||
|
sldb-mode-map
|
||||||
|
slime-inspector-mode-map
|
||||||
|
slime-mode-map
|
||||||
|
slime-popup-buffer-mode-map
|
||||||
|
slime-xref-mode-map ))
|
||||||
|
|
||||||
(defun evil-collection-slime-last-sexp (command &rest args)
|
(defun evil-collection-slime-last-sexp (command &rest args)
|
||||||
"In normal-state or motion-state, last sexp ends at point."
|
"In normal-state or motion-state, last sexp ends at point."
|
||||||
(if (and (not evil-move-beyond-eol)
|
(if (and (not evil-move-beyond-eol)
|
||||||
|
|
|
@ -60,6 +60,9 @@ This is only used if `evil-collection-term-sync-state-and-mode-p' is true."
|
||||||
|
|
||||||
;; TODO: Add support for normal-state editing.
|
;; TODO: Add support for normal-state editing.
|
||||||
|
|
||||||
|
(defconst evil-collection-term-maps '(term-raw-map
|
||||||
|
term-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-term-escape-stay ()
|
(defun evil-collection-term-escape-stay ()
|
||||||
"Go back to normal state but don't move cursor backwards.
|
"Go back to normal state but don't move cursor backwards.
|
||||||
Moving cursor backwards is the default Vim behavior but
|
Moving cursor backwards is the default Vim behavior but
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
(require 'tide nil t)
|
(require 'tide nil t)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
|
(defconst evil-collection-tide-maps '(tide-mode-map
|
||||||
|
tide-references-mode-map
|
||||||
|
tide-project-errors-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-tide-setup ()
|
(defun evil-collection-tide-setup ()
|
||||||
"Set up `evil' bindings for `tide'."
|
"Set up `evil' bindings for `tide'."
|
||||||
(evil-define-key 'normal tide-mode-map
|
(evil-define-key 'normal tide-mode-map
|
||||||
|
|
|
@ -36,6 +36,11 @@
|
||||||
(defvar transmission-info-mode-map)
|
(defvar transmission-info-mode-map)
|
||||||
(defvar transmission-peers-mode-map)
|
(defvar transmission-peers-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-transmission-maps '(transmission-mode-map
|
||||||
|
transmission-files-mode-map
|
||||||
|
transmission-info-mode-map
|
||||||
|
transmission-peers-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-transmission-setup ()
|
(defun evil-collection-transmission-setup ()
|
||||||
"Set up `evil' bindings for `transmission'."
|
"Set up `evil' bindings for `transmission'."
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,14 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Bindings for `vc-annotate'
|
;; Bindings for `vc-annotate'
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'vc-annotate)
|
(require 'vc-annotate)
|
||||||
|
|
||||||
;;; Code:
|
(defconst evil-collection-vc-annotate-maps '(vc-annotate-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-vc-annotate-setup ()
|
(defun evil-collection-vc-annotate-setup ()
|
||||||
"Set up `evil' bindings for `vc-annotate'."
|
"Set up `evil' bindings for `vc-annotate'."
|
||||||
(evil-set-initial-state 'vc-annotate-mode 'normal)
|
(evil-set-initial-state 'vc-annotate-mode 'normal)
|
||||||
|
|
|
@ -24,12 +24,14 @@
|
||||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;; Evil bindings for View.
|
;; Evil bindings for View.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'view)
|
(require 'view)
|
||||||
|
|
||||||
|
(defconst evil-collection-view-maps '(view-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-view-setup ()
|
(defun evil-collection-view-setup ()
|
||||||
"Set up `evil' bindings for `view'."
|
"Set up `evil' bindings for `view'."
|
||||||
(evil-set-initial-state 'view-mode 'normal)
|
(evil-set-initial-state 'view-mode 'normal)
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
(defvar vlf-mode-map)
|
(defvar vlf-mode-map)
|
||||||
(declare-function vlf-change-batch-size "vlf")
|
(declare-function vlf-change-batch-size "vlf")
|
||||||
|
|
||||||
|
(defconst evil-collection-vlf-maps '(vlf-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-vlf-decrease-batch-size ()
|
(defun evil-collection-vlf-decrease-batch-size ()
|
||||||
"Decrease vlf batch size by factor of 2."
|
"Decrease vlf batch size by factor of 2."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
(defvar which-key-C-h-map)
|
(defvar which-key-C-h-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-which-key-maps '(which-key-C-h-map))
|
||||||
|
|
||||||
;; `which-key'is coded so that the prompt properly shows j and k as
|
;; `which-key'is coded so that the prompt properly shows j and k as
|
||||||
;; the bindings.
|
;; the bindings.
|
||||||
(defun evil-collection-which-key-setup ()
|
(defun evil-collection-which-key-setup ()
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
(require 'evil-collection-man) ; WoMan's keymap inherits from Man.
|
(require 'evil-collection-man) ; WoMan's keymap inherits from Man.
|
||||||
(require 'woman)
|
(require 'woman)
|
||||||
|
|
||||||
|
(defconst evil-collection-woman-maps '(woman-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-woman-setup ()
|
(defun evil-collection-woman-setup ()
|
||||||
"Set up `evil' bindings for `woman'."
|
"Set up `evil' bindings for `woman'."
|
||||||
(evil-set-initial-state 'woman-mode 'normal)
|
(evil-set-initial-state 'woman-mode 'normal)
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
(require 'xref)
|
(require 'xref)
|
||||||
|
|
||||||
|
(defconst evil-collection-xref-maps '(xref--xref-buffer-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-xref-setup ()
|
(defun evil-collection-xref-setup ()
|
||||||
"Set up `evil' bindings for `xref'."
|
"Set up `evil' bindings for `xref'."
|
||||||
(evil-define-key 'normal xref--xref-buffer-mode-map
|
(evil-define-key 'normal xref--xref-buffer-mode-map
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
(defvar ztree-mode-map)
|
(defvar ztree-mode-map)
|
||||||
(defvar ztreediff-mode-map)
|
(defvar ztreediff-mode-map)
|
||||||
|
|
||||||
|
(defconst evil-collection-ztree-maps '(ztree-mode-map ztreediff-mode-map))
|
||||||
|
|
||||||
(defun evil-collection-ztree-setup ()
|
(defun evil-collection-ztree-setup ()
|
||||||
"Set up `evil' bindings for `ztree'."
|
"Set up `evil' bindings for `ztree'."
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
;; Pierre Neidhardt <ambrevar@gmail.com>
|
;; Pierre Neidhardt <ambrevar@gmail.com>
|
||||||
;; URL: https://github.com/emacs-evil/evil-collection
|
;; URL: https://github.com/emacs-evil/evil-collection
|
||||||
;; Version: 0.0.1
|
;; Version: 0.0.1
|
||||||
;; Package-Requires: ((emacs "25.1") (evil "1.2.13"))
|
;; Package-Requires: ((emacs "25.1") (cl-lib "0.5") (evil "1.2.13"))
|
||||||
;; Keywords: evil, tools
|
;; Keywords: evil, tools
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
;; This is so because many users find it confusing.
|
;; This is so because many users find it confusing.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
(require 'cl-lib)
|
||||||
(require 'evil)
|
(require 'evil)
|
||||||
|
|
||||||
(defvar evil-want-integration)
|
(defvar evil-want-integration)
|
||||||
|
@ -158,6 +158,98 @@ this confusing. It will be included if
|
||||||
:type '(repeat (choice symbol sexp))
|
:type '(repeat (choice symbol sexp))
|
||||||
:group 'evil-collection)
|
:group 'evil-collection)
|
||||||
|
|
||||||
|
(defvar evil-collection-setup-hook nil
|
||||||
|
"Hook run by `evil-collection-init' for each mode that is evilified.
|
||||||
|
This hook runs after all setup (including keybindings) for a mode has already
|
||||||
|
taken place. The arguments passed to functions for this hook are the name of the
|
||||||
|
mode and a list of keymap names (i.e. symbols, not actual keymaps) customized by
|
||||||
|
Evil Collection for that mode. More arguments may be added in the future, so
|
||||||
|
functions added to this hook should include a \"&rest _rest\" for forward
|
||||||
|
compatibility.")
|
||||||
|
|
||||||
|
(defun evil-collection--translate-key (state keymap-symbol
|
||||||
|
translations
|
||||||
|
destructive)
|
||||||
|
"Helper function for `evil-collection-translate-key'.
|
||||||
|
In the keymap corresponding to STATE and KEYMAP-SYMBOL, make the key
|
||||||
|
TRANSLATIONS. When DESTRUCTIVE is non-nil, make the TRANSLATIONS destructively
|
||||||
|
without creating/referencing a backup keymap."
|
||||||
|
(let* ((backup-keymap-symbol (intern (format "evil-collection-%s%s-backup-map"
|
||||||
|
keymap-symbol
|
||||||
|
(if state
|
||||||
|
(format "-%s-state" state)
|
||||||
|
""))))
|
||||||
|
(keymap (symbol-value keymap-symbol))
|
||||||
|
(lookup-keymap (if (and (not destructive)
|
||||||
|
(boundp backup-keymap-symbol))
|
||||||
|
(symbol-value backup-keymap-symbol)
|
||||||
|
(copy-keymap
|
||||||
|
(if state
|
||||||
|
(evil-get-auxiliary-keymap keymap state t t)
|
||||||
|
keymap))))
|
||||||
|
(maps (cl-loop for (key replacement) on translations by 'cddr
|
||||||
|
;; :destructive can be in TRANSLATIONS
|
||||||
|
unless (keywordp key)
|
||||||
|
collect key
|
||||||
|
and collect (when replacement
|
||||||
|
(lookup-key lookup-keymap replacement)))))
|
||||||
|
(unless (or destructive
|
||||||
|
(boundp backup-keymap-symbol))
|
||||||
|
(set backup-keymap-symbol lookup-keymap))
|
||||||
|
(apply #'evil-define-key* state keymap maps)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(cl-defun evil-collection-translate-key (states keymaps
|
||||||
|
&rest translations
|
||||||
|
&key destructive
|
||||||
|
&allow-other-keys)
|
||||||
|
"Translate keys in the keymap(s) corresponding to STATES and KEYMAPS.
|
||||||
|
STATES should be the name of an evil state, a list of states, or nil. KEYMAPS
|
||||||
|
should be a symbol corresponding to the keymap to make the translations in or a
|
||||||
|
list of keymap symbols. Like `evil-define-key', when a keymap does not exist,
|
||||||
|
the keybindings will be deferred until the keymap is defined, so
|
||||||
|
`with-eval-after-load' is not neccessary. TRANSLATIONS corresponds to a list of
|
||||||
|
key replacement pairs. For example, specifying \"a\" \"b\" will bind \"a\" to
|
||||||
|
\"b\"'s definition in the keymap. Specifying nil as a replacement will unbind a
|
||||||
|
key. If DESTRUCTIVE is nil, a backup of the keymap will be stored on the initial
|
||||||
|
invocation, and future invocations will always look up keys in the backup
|
||||||
|
keymap. When no TRANSLATIONS are given, this function will only create the
|
||||||
|
backup keymap without making any translations. On the other hand, if DESTRUCTIVE
|
||||||
|
is non-nil, the keymap will be destructively altered without creating a backup.
|
||||||
|
For example, calling this function multiple times with \"a\" \"b\" \"b\" \"a\"
|
||||||
|
would continue to swap and unswap the definitions of these keys. This means that
|
||||||
|
when DESTRUCTIVE is non-nil, all related swaps/cycles should be done in the same
|
||||||
|
invocation."
|
||||||
|
(declare (indent defun))
|
||||||
|
(unless (listp keymaps)
|
||||||
|
(setq keymaps (list keymaps)))
|
||||||
|
(unless (and (listp states)
|
||||||
|
(not (null states)))
|
||||||
|
(setq states (list states)))
|
||||||
|
(dolist (keymap-symbol keymaps)
|
||||||
|
(dolist (state states)
|
||||||
|
(evil-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)))))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defmacro evil-collection-swap-key (states keymaps &rest args)
|
||||||
|
"Wrapper around `evil-collection-translate-key' for swapping keys.
|
||||||
|
STATES, KEYMAPS, and ARGS are passed to `evil-collection-translate-key'. ARGS
|
||||||
|
should consist of key swaps (e.g. \"a\" \"b\" is equivalent to \"a\" \"b\" \"b\"
|
||||||
|
\"a\" with `evil-collection-translate-key') and optionally keyword arguments for
|
||||||
|
`evil-collection-translate-key'."
|
||||||
|
(declare (indent defun))
|
||||||
|
(setq args (cl-loop for (key replacement) on args by 'cddr
|
||||||
|
collect key and collect replacement
|
||||||
|
and unless (keywordp key)
|
||||||
|
collect replacement and collect key))
|
||||||
|
`(evil-collection-translate-key ,states ,keymaps ,@args))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun evil-collection-init ()
|
(defun evil-collection-init ()
|
||||||
"Register the Evil bindings for all modes in `evil-collection-mode-list'.
|
"Register the Evil bindings for all modes in `evil-collection-mode-list'.
|
||||||
|
@ -178,7 +270,14 @@ instance:
|
||||||
(dolist (req reqs)
|
(dolist (req reqs)
|
||||||
(with-eval-after-load req
|
(with-eval-after-load req
|
||||||
(require (intern (concat "evil-collection-" (symbol-name m))))
|
(require (intern (concat "evil-collection-" (symbol-name m))))
|
||||||
(funcall (intern (concat "evil-collection-" (symbol-name m) "-setup"))))))))
|
(funcall (intern (concat "evil-collection-" (symbol-name m)
|
||||||
|
"-setup")))
|
||||||
|
(let ((mode-keymaps
|
||||||
|
(ignore-errors
|
||||||
|
(symbol-value
|
||||||
|
(intern (format "evil-collection-%s-maps" m))))))
|
||||||
|
(run-hook-with-args 'evil-collection-setup-hook
|
||||||
|
m mode-keymaps)))))))
|
||||||
|
|
||||||
(defvar evil-collection-delete-operators '(evil-delete
|
(defvar evil-collection-delete-operators '(evil-delete
|
||||||
evil-cp-delete
|
evil-cp-delete
|
||||||
|
|
116
readme.org
116
readme.org
|
@ -384,6 +384,122 @@ definition".
|
||||||
- ~f11~ Step Into
|
- ~f11~ Step Into
|
||||||
- ~S-f11~ Step Out
|
- ~S-f11~ Step Out
|
||||||
|
|
||||||
|
** Key Translation
|
||||||
|
~evil-collection-translate-key~ allows binding a key to the definition of
|
||||||
|
another key in the same keymap (comparable to how vim's keybindings work). Its
|
||||||
|
arguments are the ~states~ and ~keymaps~ to bind/look up the key(s) in followed
|
||||||
|
optionally by keyword arguments (currently only ~:destructive~) and
|
||||||
|
key/replacement pairs. ~states~ should be nil for non-evil keymaps, and both
|
||||||
|
~states~ and ~keymaps~ can be a single symbol or a list of symbols.
|
||||||
|
|
||||||
|
This function can be useful for making key swaps/cycles en masse. For example,
|
||||||
|
someone who uses an alternate keyboard layout may want to retain the ~hjkl~
|
||||||
|
positions for directional movement in dired, the calendar, etc.
|
||||||
|
|
||||||
|
Here's an example for Colemak of making swaps in a single keymap:
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(evil-collection-translate-key nil 'evil-motion-state-map
|
||||||
|
;; colemak hnei is qwerty hjkl
|
||||||
|
"n" "j"
|
||||||
|
"e" "k"
|
||||||
|
"i" "l"
|
||||||
|
;; add back nei
|
||||||
|
"j" "e"
|
||||||
|
"k" "n"
|
||||||
|
"l" "i")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
Here's an example of using ~evil-collection-setup-hook~ to cycle the keys for
|
||||||
|
all modes in ~evil-collection-mode-list~:
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defun my-hjkl-rotation (_mode mode-keymaps &rest _rest)
|
||||||
|
(evil-collection-translate-key 'normal mode-keymaps
|
||||||
|
"n" "j"
|
||||||
|
"e" "k"
|
||||||
|
"i" "l"
|
||||||
|
"j" "e"
|
||||||
|
"k" "n"
|
||||||
|
"l" "i"))
|
||||||
|
|
||||||
|
;; called after evil-collection makes its keybindings
|
||||||
|
(add-hook 'evil-collection-setup-hook #'my-hjkl-rotation)
|
||||||
|
|
||||||
|
(evil-collection-init)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
A more common use case of ~evil-collection-translate-key~ would be for keeping
|
||||||
|
the functionality of some keys that users may bind globally. For example, ~SPC~,
|
||||||
|
~[~, and ~]~ are bound in some modes. If you use these keys as global prefix
|
||||||
|
keys that you never want to be overriden, you'll want to give them higher
|
||||||
|
priority than other evil keybindings (e.g. those made by ~(evil-define-key
|
||||||
|
'normal some-map ...)~). To do this, you can create an "intercept" map and bind
|
||||||
|
your prefix keys in it instead of in ~evil-normal-state-map~:
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defvar my-intercept-mode-map (make-sparse-keymap)
|
||||||
|
"High precedence keymap.")
|
||||||
|
|
||||||
|
(define-minor-mode my-intercept-mode
|
||||||
|
"Global minor mode for higher precedence evil keybindings."
|
||||||
|
:global t)
|
||||||
|
|
||||||
|
(my-intercept-mode)
|
||||||
|
|
||||||
|
(dolist (state '(normal visual insert))
|
||||||
|
(evil-make-intercept-map
|
||||||
|
;; NOTE: This requires an evil version from 2018-03-20 or later
|
||||||
|
(evil-get-auxiliary-keymap my-intercept-mode-map state t t)
|
||||||
|
state))
|
||||||
|
|
||||||
|
(evil-define-key 'normal my-intercept-mode-map
|
||||||
|
(kbd "SPC f") 'find-file)
|
||||||
|
;; ...
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
You can then define replacement keys:
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defun my-prefix-translations (_mode mode-keymaps &rest _rest)
|
||||||
|
(evil-collection-translate-key 'normal mode-keymaps
|
||||||
|
"C-SPC" "SPC"
|
||||||
|
;; these need to be unbound first; this needs to be in same statement
|
||||||
|
"[" nil
|
||||||
|
"]" nil
|
||||||
|
"[[" "["
|
||||||
|
"]]" "]"))
|
||||||
|
|
||||||
|
(add-hook 'evil-collection-setup-hook #'my-prefix-translation)
|
||||||
|
|
||||||
|
(evil-collection-init)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
By default, the first invocation of ~evil-collection-translate-key~ will make a
|
||||||
|
backup of the keymap. Each subsequent invocation will look up keys in the backup
|
||||||
|
instead of the original. This means that a call to
|
||||||
|
~evil-collection-translate-key~ will always have the same behavior even if
|
||||||
|
evaluated multiple times. When ~:destructive t~ is specified, keys are looked up
|
||||||
|
in the keymap as it is currently. This means that a call to
|
||||||
|
~evil-collection-translate-key~ that swapped two keys would continue to
|
||||||
|
swap/unswap them with each call. Therefore when ~:destructive t~ is used, all
|
||||||
|
cycles/swaps must be done within a single call to
|
||||||
|
~evil-collection-translate-key~. To make a comparison to Vim keybindings,
|
||||||
|
~:destructive t~ is comparable to Vim's ~map~, and ~:destructive nil~ is
|
||||||
|
comparable to vim's ~noremap~ (where the "original" keybindings are those that
|
||||||
|
existed in the keymap when ~evil-collection-translate-key~ was first called).
|
||||||
|
You'll almost always want to use the default behavior (especially in your init
|
||||||
|
file). The limitation of ~:destructive nil~ is that you can't translate a key to
|
||||||
|
another key that was defined after the first ~evil-collection-translate-key~, so
|
||||||
|
~:destructive t~ may be useful for interactive experimentation.
|
||||||
|
|
||||||
|
~evil-collection-swap-key~ is also provided as a wrapper around
|
||||||
|
~evil-colletion-translate-key~ that allows swapping keys:
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(evil-collection-swap-key nil 'evil-motion-state-map
|
||||||
|
";" ":")
|
||||||
|
;; is equivalent to
|
||||||
|
(evil-collection-translate-key nil 'evil-motion-state-map
|
||||||
|
";" ":"
|
||||||
|
":" ";")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
** Modes left behind
|
** Modes left behind
|
||||||
|
|
||||||
Some modes might still remain unsupported by this package. Should you be
|
Some modes might still remain unsupported by this package. Should you be
|
||||||
|
|
Loading…
Reference in New Issue