aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Dalziel <tom_dl@hotmail.com>2024-07-10 18:37:29 +0200
committerTom Dalziel <33435574+tomdl89@users.noreply.github.com>2024-07-10 17:42:46 +0100
commit1a5ddab958982b6bf5e21bc7cb0f77a64415479d (patch)
tree688e2de323279a8d0486313ac0b4df4989ede5bd
parentf5215fd59b6118f393a6fae3649b35f4e4e8ef0e (diff)
gi works in visual line state
-rw-r--r--evil-commands.el5
-rw-r--r--evil-tests.el21
2 files changed, 25 insertions, 1 deletions
diff --git a/evil-commands.el b/evil-commands.el
index 3a0b3b3..45a6e67 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2734,11 +2734,14 @@ the lines."
(evil-insert count vcount skip-empty-lines)
(add-hook 'post-command-hook #'evil-maybe-remove-spaces)))
-(defun evil-insert-resume (count)
+(evil-define-command evil-insert-resume (count)
"Switch to Insert state at previous insertion point.
The insertion will be repeated COUNT times. If called from visual
state, only place point at the previous insertion position but do not
switch to insert state."
+ :keep-visual t
+ :type exclusive
+ :jump t
(interactive "p")
(evil-goto-mark ?^ t)
(unless (evil-visual-state-p)
diff --git a/evil-tests.el b/evil-tests.el
index fb06d76..7ccef73 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -6075,6 +6075,27 @@ This buffer is for notes."
("]}")
"{ (\"Test with paren {inside multi {level}[}]\", test()); } "))
+(ert-deftest evil-test-insert-resume ()
+ "Test `evil-insert-resume'"
+ :tags '(evil motion)
+ (ert-info ("Can move to last insert location and take a count")
+ (evil-test-buffer
+ "alpha bravo [ ]delta echo"
+ ("i" "charlie" [escape] "^")
+ "[a]lpha bravo charlie delta echo"
+ ("2gi" " zulu" [escape])
+ "alpha bravo charlie zulu zul[u] delta echo"))
+ (ert-info ("Can move to `^' marker in visual line state")
+ (evil-test-buffer
+ "alpha [b]ravo\ncharlie delta\necho foxtrot"
+ ("i" [escape] "/foxtrot" [return])
+ "alpha bravo\ncharlie delta\necho [f]oxtrot"
+ ("Vk")
+ "alpha bravo\ncharl[i]e delta\necho foxtrot"
+ ("gi")
+ "alpha [b]ravo\ncharlie delta\necho foxtrot"
+ ("vd")
+ "alpha [o]xtrot")))
(ert-deftest evil-test-next-mark ()
"Test `evil-next-mark', `evil-previous-mark'"