From ddabf8bc81606209e6aeb9557da83a1dedaaa899 Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 2 Jun 2020 22:25:30 -0400 Subject: [PATCH 1/2] Added paste-transient-state to API recipes Replicates spacemacs' paste-transient-state, felt it may be useful as a starting example for something slightly more complex to make Spacemacs users feel more at home. I'm happy to move it if you feel it belongs somewhere else, and no love lost if you don't wish to include this at all. --- docs/api.org | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/api.org b/docs/api.org index 583841b11..15d8b6519 100644 --- a/docs/api.org +++ b/docs/api.org @@ -565,3 +565,25 @@ than unwarranted characters. Alternatively, an updated version exists at [[https://github.com/amosbird/evil-terminal-cursor-changer][amosbird/evil-terminal-cursor-changer]], with support for urxvt and tmux. + +** Create a paste-transient-state to cycle through kill ring on paste +Replaces the default evil-paste binding to paste then let you cycle through entries in your kill ring. Gives you more flexibility when copying to your clipboard, making edits, then deciding to paste after. + +You will need to enable the `hydra` module first. + +#+BEGIN_SRC elisp +(defhydra hydra-paste (:color red + :hint nil) + "\n[%s(length kill-ring-yank-pointer)/%s(length kill-ring)] \ + [_C-j_/_C-k_] cycles through yanked text, [_p_/_P_] pastes the same text \ + above or below. Anything else exits." + ("C-j" evil-paste-pop) + ("C-k" evil-paste-pop-next) + ("p" evil-paste-after) + ("P" evil-paste-before)) + +(evil-define-key* '(normal visual) 'global + (kbd "p") #'hydra-paste/evil-paste-after + (kbd "P") #'hydra-paste/evil-paste-before) +#+END_SRC + From 3e90ef7c8b9220673cf8bc3682518e422fddeeeb Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 2 Jun 2020 22:53:48 -0400 Subject: [PATCH 2/2] Replaced evil-define-key with map! --- docs/api.org | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/api.org b/docs/api.org index 15d8b6519..54ca1d288 100644 --- a/docs/api.org +++ b/docs/api.org @@ -582,8 +582,7 @@ You will need to enable the `hydra` module first. ("p" evil-paste-after) ("P" evil-paste-before)) -(evil-define-key* '(normal visual) 'global - (kbd "p") #'hydra-paste/evil-paste-after - (kbd "P") #'hydra-paste/evil-paste-before) +(map! :nv "p" #'hydra-paste/evil-paste-after + :nv "P" #'hydra-paste/evil-paste-before) #+END_SRC