Disable paste transient state when multiple cursors are active

evil-mc has no support for the 'paste transient state', hence we should fall back
to the default version during that period.
This commit is contained in:
Koray Al 2017-04-01 02:10:44 +03:00 committed by syl20bnr
parent bf2892b198
commit 58458f2d2a

View file

@ -107,12 +107,28 @@
(use-package evil-mc
:defer t
:init
;; remove emc prefix when there is not multiple cursors
(setq evil-mc-mode-line
`(:eval (when (> (evil-mc-get-cursor-count) 1)
(format ,(propertize " %s:%d" 'face 'cursor)
evil-mc-mode-line-prefix
(evil-mc-get-cursor-count)))))))
(progn
(defun spacemacs-evil/evil-mc-paste-after (&optional count &optional register)
(interactive "p")
(if (and (eq (evil-mc-get-cursor-count) 1) dotspacemacs-enable-paste-transient-state)
(spacemacs/paste-transient-state/evil-paste-after)
(evil-paste-after count register)))
(defun spacemacs-evil/evil-mc-paste-before (&optional count &optional register)
(interactive "p")
(if (and (eq (evil-mc-get-cursor-count) 1) dotspacemacs-enable-paste-transient-state)
(spacemacs/paste-transient-state/evil-paste-before)
(evil-paste-before count register)))
(define-key evil-normal-state-map "p" 'spacemacs-evil/evil-mc-paste-after)
(define-key evil-normal-state-map "P" 'spacemacs-evil/evil-mc-paste-before)
;; remove emc prefix when there is not multiple cursors
(setq evil-mc-mode-line
`(:eval (when (> (evil-mc-get-cursor-count) 1)
(format ,(propertize " %s:%d" 'face 'cursor)
evil-mc-mode-line-prefix
(evil-mc-get-cursor-count))))))))
;; other commenting functions in funcs.el with keybinds in keybindings.el
(defun spacemacs-evil/init-evil-nerd-commenter ()