Skip to content

Commit

Permalink
gi works in visual line state
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdl89 committed Jul 10, 2024
1 parent f5215fd commit 48cdd8d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion evil-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions evil-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -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'"
Expand Down

0 comments on commit 48cdd8d

Please sign in to comment.