Check for universal arg before paste
This commit fixes #4219 and fixes #8897
This commit is contained in:
parent
4add7d478d
commit
554ca097f2
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
(defun spacemacs/evil-mc-paste-after (&optional count register)
|
(defun spacemacs/evil-mc-paste-after (&optional count register)
|
||||||
"Disable paste transient state if there is more than 1 cursor."
|
"Disable paste transient state if there is more than 1 cursor."
|
||||||
(interactive "p")
|
(interactive "*P")
|
||||||
(setq this-command 'evil-paste-after)
|
(setq this-command 'evil-paste-after)
|
||||||
(if (spacemacs//evil-mc-paste-transient-state-p)
|
(if (spacemacs//evil-mc-paste-transient-state-p)
|
||||||
(spacemacs/paste-transient-state/evil-paste-after)
|
(spacemacs/paste-transient-state/evil-paste-after)
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
(defun spacemacs/evil-mc-paste-before (&optional count register)
|
(defun spacemacs/evil-mc-paste-before (&optional count register)
|
||||||
"Disable paste transient state if there is more than 1 cursor."
|
"Disable paste transient state if there is more than 1 cursor."
|
||||||
(interactive "p")
|
(interactive "*P")
|
||||||
(setq this-command 'evil-paste-before)
|
(setq this-command 'evil-paste-before)
|
||||||
(if (spacemacs//evil-mc-paste-transient-state-p)
|
(if (spacemacs//evil-mc-paste-transient-state-p)
|
||||||
(spacemacs/paste-transient-state/evil-paste-before)
|
(spacemacs/paste-transient-state/evil-paste-before)
|
||||||
|
|
|
@ -1313,22 +1313,26 @@ Compare them on count first,and in case of tie sort them alphabetically."
|
||||||
(if (<= (- end beg) spacemacs-yank-indent-threshold)
|
(if (<= (- end beg) spacemacs-yank-indent-threshold)
|
||||||
(indent-region beg end nil)))
|
(indent-region beg end nil)))
|
||||||
|
|
||||||
(spacemacs|advise-commands
|
(defun spacemacs//yank-indent-region (yank-func &rest args)
|
||||||
"indent" (yank yank-pop evil-paste-before evil-paste-after) around
|
|
||||||
"If current mode is not one of spacemacs-indent-sensitive-modes
|
"If current mode is not one of spacemacs-indent-sensitive-modes
|
||||||
indent yanked text (with universal arg don't indent)."
|
indent yanked text (with universal arg don't indent)."
|
||||||
(evil-start-undo-step)
|
(evil-start-undo-step)
|
||||||
ad-do-it
|
(let ((prefix (car args)))
|
||||||
(if (and (not (equal '(4) (ad-get-arg 0)))
|
(setcar args (unless (equal '(4) prefix) prefix))
|
||||||
|
(apply yank-func args)
|
||||||
|
(if (and (not (equal '(4) prefix))
|
||||||
(not (member major-mode spacemacs-indent-sensitive-modes))
|
(not (member major-mode spacemacs-indent-sensitive-modes))
|
||||||
(or (derived-mode-p 'prog-mode)
|
(or (derived-mode-p 'prog-mode)
|
||||||
(member major-mode spacemacs-indent-sensitive-modes)))
|
(member major-mode spacemacs-indent-sensitive-modes)))
|
||||||
(let ((transient-mark-mode nil)
|
(let ((transient-mark-mode nil)
|
||||||
(save-undo buffer-undo-list))
|
(save-undo buffer-undo-list))
|
||||||
(spacemacs/yank-advised-indent-function (region-beginning)
|
(spacemacs/yank-advised-indent-function (region-beginning)
|
||||||
(region-end))))
|
(region-end)))))
|
||||||
(evil-end-undo-step))
|
(evil-end-undo-step))
|
||||||
|
|
||||||
|
(dolist (func '(yank yank-pop evil-paste-before evil-paste-after))
|
||||||
|
(advice-add func :around #'spacemacs//yank-indent-region))
|
||||||
|
|
||||||
;; find file functions in split
|
;; find file functions in split
|
||||||
(defun spacemacs//display-in-split (buffer alist)
|
(defun spacemacs//display-in-split (buffer alist)
|
||||||
"Split selected window and display BUFFER in the new window.
|
"Split selected window and display BUFFER in the new window.
|
||||||
|
|
|
@ -61,7 +61,6 @@ Otherwise, revert to the default behavior (i.e. enable `evil-insert-state')."
|
||||||
(evil-escape-mode t)
|
(evil-escape-mode t)
|
||||||
(evil-escape-mode -1)))
|
(evil-escape-mode -1)))
|
||||||
|
|
||||||
|
|
||||||
(defun spacemacs/linum-relative-toggle ()
|
(defun spacemacs/linum-relative-toggle ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (not (bound-and-true-p linum-relative-mode))
|
(if (not (bound-and-true-p linum-relative-mode))
|
||||||
|
|
Loading…
Reference in a new issue