2018-08-04 19:38:05 +00:00
|
|
|
;; -*- lexical-binding: t -*-
|
|
|
|
;;
|
|
|
|
;;; packages.el --- Spacemacs Multiple Cursors Layer packages File
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2018-08-04 19:38:05 +00:00
|
|
|
;;
|
|
|
|
;; Author: Codruț Constantin Gușoi <codrut.gusoi@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
(setq multiple-cursors-packages
|
2018-11-05 11:31:55 +00:00
|
|
|
'(
|
2019-05-24 18:30:10 +00:00
|
|
|
(evil-mc :toggle (eq multiple-cursors-backend 'evil-mc))
|
|
|
|
(multiple-cursors :toggle (eq multiple-cursors-backend 'mc))))
|
2018-08-04 19:38:05 +00:00
|
|
|
|
|
|
|
(defun multiple-cursors/init-evil-mc ()
|
|
|
|
(use-package evil-mc
|
2019-11-13 06:08:42 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2020-11-27 21:13:25 +00:00
|
|
|
(which-key-add-keymap-based-replacements evil-motion-state-map
|
|
|
|
"gr" "evil-mc")
|
2019-11-13 06:08:42 +00:00
|
|
|
(add-hook 'prog-mode-hook 'turn-on-evil-mc-mode)
|
|
|
|
(add-hook 'text-mode-hook 'turn-on-evil-mc-mode))
|
2018-08-04 19:38:05 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2020-09-23 20:37:55 +00:00
|
|
|
(add-hook 'magit-mode-hook 'turn-off-evil-mc-mode)
|
2019-03-02 10:24:05 +00:00
|
|
|
(setq-default evil-mc-one-cursor-show-mode-line-text nil)
|
2018-08-04 19:38:05 +00:00
|
|
|
(when (or (spacemacs/system-is-mac) (spacemacs/system-is-mswindows))
|
|
|
|
(setq evil-mc-enable-bar-cursor nil))
|
|
|
|
|
|
|
|
;; evil-mc is not compatible with the paste transient state
|
2019-11-13 06:08:42 +00:00
|
|
|
(evil-define-key 'normal evil-mc-key-map
|
|
|
|
"p" #'spacemacs/evil-mc-paste-after
|
|
|
|
"P" #'spacemacs/evil-mc-paste-before)
|
2018-08-04 19:38:05 +00:00
|
|
|
|
2019-11-13 06:08:42 +00:00
|
|
|
(evil-define-key '(normal insert) evil-mc-key-map
|
|
|
|
(kbd "C-M-j") #'evil-mc-make-cursor-move-next-line
|
2019-11-25 16:45:01 +00:00
|
|
|
(kbd "C-M-k") #'evil-mc-make-cursor-move-prev-line))))
|
2019-05-24 18:30:10 +00:00
|
|
|
|
|
|
|
(defun multiple-cursors/init-multiple-cursors ()
|
|
|
|
(use-package multiple-cursors
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs/declare-prefix "sm" "multiple-cursors")
|
|
|
|
(spacemacs/declare-prefix "sms" "specials")
|
|
|
|
(spacemacs/set-leader-keys
|
2019-05-27 13:44:51 +00:00
|
|
|
"sma" 'mc/mark-all-dwim
|
|
|
|
"smb" 'mc/mark-all-like-this
|
2019-05-24 18:30:10 +00:00
|
|
|
"smm" 'mc/mark-more-like-this-extended
|
|
|
|
"smr" 'mc/edit-lines
|
2019-05-27 13:44:51 +00:00
|
|
|
"smsl" 'mc/insert-letters
|
2019-05-24 18:30:10 +00:00
|
|
|
"smsm" 'mc/mark-sgml-tag-pair
|
|
|
|
"smsn" 'mc/insert-numbers
|
2019-05-27 13:44:51 +00:00
|
|
|
"smsr" 'set-rectangular-region-anchor
|
|
|
|
"smss" 'mc/sort-regions
|
2019-05-24 18:30:10 +00:00
|
|
|
"smst" 'mc/reverse-regions)
|
|
|
|
(setq mc/always-run-for-all t)
|
|
|
|
(with-eval-after-load 'multiple-cursors-core
|
2020-05-11 10:36:56 +00:00
|
|
|
(add-to-list 'mc/cmds-to-run-once 'spacemacs/helm-M-x-fuzzy-matching)
|
2019-05-24 18:30:10 +00:00
|
|
|
(add-to-list 'mc/cmds-to-run-once 'counsel-M-x)
|
2020-11-27 19:18:32 +00:00
|
|
|
(add-to-list 'mc/cmds-to-run-once 'spacemacs/default-pop-shell)))))
|