(Emacs)~evil-mc definition emacs->general

The keybindings used to use :bind, which relies on the
underlying (define-key) mechanism of Emacs.  However, as general is
loaded beforehand and it provides a ton of useful wrappers, let's use
those instead.

Makes the code look nicer as well.
This commit is contained in:
2022-01-06 00:42:46 +00:00
parent 25930bcd7c
commit da77d7408d

View File

@@ -418,21 +418,23 @@ which pauses cursors upon placing a cursor at the current position.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package evil-mc (use-package evil-mc
:after evil :after evil
:bind (("M-p" . evil-mc-skip-and-goto-prev-cursor) :general
:map +dx:evil-mc-map (general-nmap ("M-p" evil-mc-skip-and-goto-prev-cursor))
("q" . evil-mc-undo-all-cursors) (dx:evil-mc-map
("d" . evil-mc-make-and-goto-next-match) ("q" . evil-mc-undo-all-cursors)
("j" . evil-mc-make-cursor-move-next-line) ("d" . evil-mc-make-and-goto-next-match)
("k" . evil-mc-make-cursor-move-prev-line) ("j" . evil-mc-make-cursor-move-next-line)
("j" . evil-mc-make-cursor-move-next-line) ("k" . evil-mc-make-cursor-move-prev-line)
("m" . evil-mc-make-all-cursors) ("j" . evil-mc-make-cursor-move-next-line)
("z" . +dx/evil-mc-cursor-here) ("m" . evil-mc-make-all-cursors)
("r" . evil-mc-resume-cursors) ("z" . +dx/evil-mc-cursor-here)
("s" . evil-mc-pause-cursors)) ("r" . evil-mc-resume-cursors)
("s" . evil-mc-pause-cursors))
:init :init
(setq evil-mc-key-map nil) (setq evil-mc-key-map nil)
(define-prefix-command '+dx:evil-mc-map) (general-create-definer dx:evil-mc-map
(bind-key "gz" +dx:evil-mc-map evil-normal-state-map) :states 'normal
:prefix "gz")
:config :config
(global-evil-mc-mode +1) (global-evil-mc-mode +1)
(defun +dx/evil-mc-cursor-here () (defun +dx/evil-mc-cursor-here ()