Skip to content

vim: Fix dot repeat after replaying a macro#57698

Open
Liberxue wants to merge 1 commit into
zed-industries:mainfrom
Liberxue:vim-dot-repeat-after-macro
Open

vim: Fix dot repeat after replaying a macro#57698
Liberxue wants to merge 1 commit into
zed-industries:mainfrom
Liberxue:vim-dot-repeat-after-macro

Conversation

@Liberxue

@Liberxue Liberxue commented May 26, 2026

Copy link
Copy Markdown
Contributor

Replaying a macro via @<reg> dispatches actions through Replayer, but its Insertion branch writes the buffer with replay_insert_event, which bypasses the InputHandled event that feeds observe_insertion. The dot-recording started by the replayed InsertBefore therefore sealed an empty insertion into recorded_actions, so pressing . after @<reg> only re-entered and exited insert mode without inserting any text.

Add observe_replayed_insertion that feeds the dot-recording stream only, and call it from Replayer::next after each replayed insertion. The existing dot-recording machinery then captures the last change inside the macro, matching Vim's . semantics for both single- and multi-change macros.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Closes #47251

Release Notes:

  • Fixed . not repeating after replaying a macro with @<reg> in vim mode

examples :

20260526-examples.mp4

Replaying a macro via @<reg> dispatches actions through Replayer, but its
Insertion branch writes the buffer with replay_insert_event, which bypasses
the InputHandled event that feeds observe_insertion. The dot-recording
started by the replayed InsertBefore therefore sealed an empty insertion
into recorded_actions, so `.` after @<reg> only re-entered and exited
insert mode without inserting any text.

Add observe_replayed_insertion that feeds the dot-recording stream only,
and call it from Replayer::next after each replayed insertion.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label May 26, 2026
@smitbarmase smitbarmase added the area:parity/vim Feedback for Vim parity features label May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:parity/vim Feedback for Vim parity features cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vim mode: Repeat does not repeat macros

2 participants