diff options
Diffstat (limited to '.config/emacs/lisp/evil-collection/modes/evil-mc')
| -rw-r--r-- | .config/emacs/lisp/evil-collection/modes/evil-mc/README.org | 49 | ||||
| -rw-r--r-- | .config/emacs/lisp/evil-collection/modes/evil-mc/evil-collection-evil-mc.el | 79 |
2 files changed, 128 insertions, 0 deletions
diff --git a/.config/emacs/lisp/evil-collection/modes/evil-mc/README.org b/.config/emacs/lisp/evil-collection/modes/evil-mc/README.org new file mode 100644 index 0000000..c23adfd --- /dev/null +++ b/.config/emacs/lisp/evil-collection/modes/evil-mc/README.org @@ -0,0 +1,49 @@ +* evil-mc + + Evil bindings for [[https://github.com/gabesoft/evil-mc][evil-mc]], multiple cursors for evil. + + Upstream installs its cursors map under =gr= on top of the normal/visual + state. evil-collection clears both =evil-mc-key-map= and + =evil-mc-cursors-map= and re-installs the cursors map under =g.= so =gr= + stays free for =xref-find-references=. + +** Key bindings + +*** evil-mc-key-map + + | Command | Original | Evil | + |-----------------------+----------+------| + | =evil-mc-cursors-map= | =gr= | =g.= | + +*** evil-mc-cursors-map + + Prefix is =g.= in normal/visual state. + + | Command | Original | Evil | + |-----------------------------------------------+----------+---------| + | =evil-mc-make-all-cursors= | =m= | =a= | + | =evil-mc-undo-all-cursors= | =q= | =q= | + | =evil-mc-undo-last-added-cursor= | =u= | =u= | + | =evil-mc-pause-cursors= | =s= | =C-p= | + | =evil-mc-resume-cursors= | =r= | =C-r= | + | =evil-mc-make-cursor-here= | =h= | =C-m= | + | =evil-mc-make-and-goto-first-cursor= | =f= | =0= | + | =evil-mc-make-and-goto-last-cursor= | =l= | =$= | + | =evil-mc-make-cursor-in-visual-selection-beg= | =I= | =I= | + | =evil-mc-make-cursor-in-visual-selection-end= | =A= | =A= | + | =evil-mc-make-cursor-move-next-line= | =j= | =o= | + | =evil-mc-make-cursor-move-prev-line= | =k= | =O= | + | =evil-mc-make-and-goto-next-match= | =n= | =n= | + | =evil-mc-make-and-goto-prev-match= | =N= | =N= | + | =evil-mc-skip-and-goto-next-match= | =n= | =C-n= | + | =evil-mc-skip-and-goto-prev-match= | =p= | =C-S-n= | + | =evil-mc-make-and-goto-next-cursor= | =M-n= | =M-n= | + | =evil-mc-make-and-goto-prev-cursor= | =M-p= | =M-N= | + | =evil-mc-skip-and-goto-next-cursor= | =N= | =C-u= | + | =evil-mc-skip-and-goto-prev-cursor= | =P= | =C-S-u= | + +** Notes + + A hook on =evil-mc-after-cursors-deleted= sets + =evil-was-yanked-without-register= so paste after cursor deletion does + not clobber the unnamed register (see upstream issue #70). diff --git a/.config/emacs/lisp/evil-collection/modes/evil-mc/evil-collection-evil-mc.el b/.config/emacs/lisp/evil-collection/modes/evil-mc/evil-collection-evil-mc.el new file mode 100644 index 0000000..7de6405 --- /dev/null +++ b/.config/emacs/lisp/evil-collection/modes/evil-mc/evil-collection-evil-mc.el @@ -0,0 +1,79 @@ +;;; evil-collection-evil-mc.el --- Bindings for evil-mc -*- lexical-binding: t -*- + +;; Copyright (C) 2018 James Nguyen + +;; Author: James Nguyen <james@jojojames.com> +;; Maintainer: James Nguyen <james@jojojames.com> +;; Pierre Neidhardt <mail@ambrevar.xyz> +;; URL: https://github.com/emacs-evil/evil-collection +;; Version: 0.0.2 +;; Package-Requires: ((emacs "26.3")) +;; Keywords: evil, emacs, tools + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;;; Bindings for evil-mc. + +;;; Code: +(require 'evil-collection) +(require 'evil-mc nil t) +(eval-when-compile (require 'subr-x)) ; `if-let*' and `when-let*' + +(defvar evil-mc-key-map) +(defvar evil-mc-cursors-map) +(defconst evil-collection-evil-mc-maps '(evil-mc-key-map evil-mc-cursors-map)) + +;;;###autoload +(defun evil-collection-evil-mc-setup () + "Set up `evil' bindings for evil-mc." + + (setcdr evil-mc-cursors-map nil) + + (define-key evil-mc-cursors-map (kbd "a") 'evil-mc-make-all-cursors) + (define-key evil-mc-cursors-map (kbd "q") 'evil-mc-undo-all-cursors) + (define-key evil-mc-cursors-map (kbd "u") 'evil-mc-undo-last-added-cursor) + + (define-key evil-mc-cursors-map (kbd "C-p") 'evil-mc-pause-cursors) + (define-key evil-mc-cursors-map (kbd "C-r") 'evil-mc-resume-cursors) + (define-key evil-mc-cursors-map (kbd "C-m") 'evil-mc-make-cursor-here) + + (define-key evil-mc-cursors-map (kbd "0") 'evil-mc-make-and-goto-first-cursor) + (define-key evil-mc-cursors-map (kbd "$") 'evil-mc-make-and-goto-last-cursor) + + (define-key evil-mc-cursors-map (kbd "I") 'evil-mc-make-cursor-in-visual-selection-beg) + (define-key evil-mc-cursors-map (kbd "A") 'evil-mc-make-cursor-in-visual-selection-end) + + (define-key evil-mc-cursors-map (kbd "o") 'evil-mc-make-cursor-move-next-line) + (define-key evil-mc-cursors-map (kbd "O") 'evil-mc-make-cursor-move-prev-line) + + (define-key evil-mc-cursors-map (kbd "n") 'evil-mc-make-and-goto-next-match) + (define-key evil-mc-cursors-map (kbd "N") 'evil-mc-make-and-goto-prev-match) + (define-key evil-mc-cursors-map (kbd "C-n") 'evil-mc-skip-and-goto-next-match) + (define-key evil-mc-cursors-map (kbd "C-S-n") 'evil-mc-skip-and-goto-prev-match) + (define-key evil-mc-cursors-map (kbd "M-n") 'evil-mc-make-and-goto-next-cursor) + (define-key evil-mc-cursors-map (kbd "M-N") 'evil-mc-make-and-goto-prev-cursor) + (define-key evil-mc-cursors-map (kbd "C-u") 'evil-mc-skip-and-goto-next-cursor) + (define-key evil-mc-cursors-map (kbd "C-S-u") 'evil-mc-skip-and-goto-prev-cursor) + + (setcdr evil-mc-key-map nil) + (evil-collection-define-key '(normal visual) 'evil-mc-key-map (kbd "g.") evil-mc-cursors-map) + + ;; https://github.com/gabesoft/evil-mc/issues/70 + (add-hook 'evil-mc-after-cursors-deleted + (lambda () + (setq evil-was-yanked-without-register t)))) + +(provide 'evil-collection-evil-mc) +;;; evil-collection-evil-mc.el ends here |
