[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil 87a1fc7fdf: Add gp and gP
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil 87a1fc7fdf: Add gp and gP |
Date: |
Tue, 9 Aug 2022 17:58:23 -0400 (EDT) |
branch: elpa/evil
commit 87a1fc7fdf75feaac1b0fd163ca60694eda1834e
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Add gp and gP
---
evil-commands.el | 20 ++++++++++++++++++++
evil-maps.el | 2 ++
evil-tests.el | 11 +++++++++++
3 files changed, 33 insertions(+)
diff --git a/evil-commands.el b/evil-commands.el
index 9756067c9f..072f805b94 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2227,6 +2227,26 @@ The return value is the yanked text."
(setq evil-last-paste nil))
(and (> (length text) 0) text)))))
+(evil-define-command evil-paste-before-cursor-after
+ (count &optional register yank-handler)
+ "The same as `evil-paste-before' but
+leave the cursor just after the new text."
+ :suppress-operator t
+ (interactive "*P<x>")
+ (setq count (prefix-numeric-value count))
+ (evil-paste-before count register yank-handler)
+ (evil-forward-char 1 nil t))
+
+(evil-define-command evil-paste-after-cursor-after
+ (count &optional register yank-handler)
+ "The same as `evil-paste-after' but
+leave the cursor just after the new text."
+ :suppress-operator t
+ (interactive "*P<x>")
+ (setq count (prefix-numeric-value count))
+ (evil-paste-after count register yank-handler)
+ (evil-forward-char 1 nil t))
+
(defun evil-insert-for-yank-at-col (startcol _endcol string count)
"Insert STRING at STARTCOL."
(move-to-column startcol)
diff --git a/evil-maps.el b/evil-maps.el
index e9d6c5a9a0..5c7a5948ad 100644
--- a/evil-maps.el
+++ b/evil-maps.el
@@ -68,6 +68,8 @@
(define-key evil-normal-state-map "gi" 'evil-insert-resume)
(define-key evil-normal-state-map "gI" 'evil-insert-0-line)
(define-key evil-normal-state-map "gJ" 'evil-join-whitespace)
+(define-key evil-normal-state-map "gp" 'evil-paste-after-cursor-after)
+(define-key evil-normal-state-map "gP" 'evil-paste-before-cursor-after)
(define-key evil-normal-state-map "gq" 'evil-fill-and-move)
(define-key evil-normal-state-map "gw" 'evil-fill)
(define-key evil-normal-state-map "gu" 'evil-downcase)
diff --git a/evil-tests.el b/evil-tests.el
index d50665eb7e..457c5b52ef 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -3103,6 +3103,17 @@ word3[]"))
("\"nyt=" "A\C-r=" "\C-rn" [return])
"50/10 * 100 = 500")))
+(ert-deftest evil-test-gp-gP ()
+ (ert-info ("gp and gP are just like p and P but move the cursor forward")
+ (evil-test-buffer
+ "[a]lpha bravo charlie"
+ ("ye" "2f " "gp")
+ "alpha bravo alpha[c]harlie"
+ ("2F " "gP")
+ "alphaalpha[ ]bravo alphacharlie"
+ ("l" "ve" "gp")
+ "alphaalpha alpha[ ]alphacharlie")))
+
(ert-deftest evil-test-ex-put ()
"evil-ex-put inserts text linewise, regardless of yank-handler"
(ert-info ("Can put linewise text from default register, by line number")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/evil 87a1fc7fdf: Add gp and gP,
ELPA Syncer <=