From e84dee8f2d40bfeeceb8d4e2dee81943699cffda Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Sat, 7 Mar 2015 17:23:01 -0500 Subject: [PATCH] Simplified past micro-state --- spacemacs/packages.el | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/spacemacs/packages.el b/spacemacs/packages.el index 4684a2300..920a3f7fb 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -670,42 +670,17 @@ which require an initialization must be listed explicitly in the list.") (">" spacemacs/scroll-half-page-down)) ;; pasting micro-state + (defadvice evil-paste-before (after spacemacs/evil-paste-before activate) + "Initate the paste micro-state after the execution of evil-paste-before" + (spacemacs/paste-micro-state)) + (defadvice evil-paste-after (after spacemacs/evil-paste-after activate) + "Initate the paste micro-state after the execution of evil-paste-after" + (spacemacs/paste-micro-state)) (spacemacs|define-micro-state paste :doc "keep pressing [p] or [P] to cycle between previous or next yanked text" :bindings - ("p" spacemacs/paste-pop) - ("P" spacemacs/paste-pop-next)) - - (defun spacemacs/paste-pop (count) - "Paste and pop yank ring" - (interactive "p") - (setq last-command 'evil-paste-before) - (evil-paste-pop count)) - - (defun spacemacs/paste-pop-next (count) - "Paste and pop yank ring with negative argument" - (interactive "p") - (setq last-command 'evil-paste-before) - (evil-paste-pop-next count)) - - (evil-define-command spacemacs/paste-before - (count &optional register yank-handler) - "Paste yanked text before point and switch to micro-state." - (interactive "P") - (evil-paste-before count register yank-handler) - (setq last-command 'evil-paste-before) - (spacemacs/paste-micro-state)) - - (evil-define-command spacemacs/paste-after - (count &optional register yank-handler) - "Paste yanked text after point and switch to micro-state." - (interactive "P") - (evil-paste-after count register yank-handler) - (setq last-command 'evil-paste-after) - (spacemacs/paste-micro-state)) - - (define-key evil-normal-state-map "p" 'spacemacs/paste-after) - (define-key evil-normal-state-map "P" 'spacemacs/paste-before) + ("p" evil-paste-pop) + ("P" evil-paste-pop-next)) ;; define text objects (defmacro spacemacs|define-and-bind-text-object (key name start-regex end-regex)