Skip to content

feat: Emit vim-mode-change event on command mode enter and exit (#251) - #280

Open
oller wants to merge 1 commit into
replit:masterfrom
oller:command-mode-change-event
Open

oller wants to merge 1 commit into
replit:masterfrom
oller:command-mode-change-event

Conversation

@oller

@oller oller commented Oct 17, 2026

Copy link
Copy Markdown

Why

Resolves #251.

Vim considers command-line mode a distinct primary mode, but vim-mode-change was not emitted when entering or exiting command-line prompts (:, /, ?). Consumers had to track dialog state manually.

What changed

  • Emit vim-mode-change with { mode: "command" } when an interactive prompt opens.
  • Emit vim-mode-change with the restored mode (normal, visual, or insert) when the prompt closes or is cancelled via Escape.
  • Filter out non-interactive notification banners (such as yank confirmations) so only prompts with input fields trigger command mode.
  • Export VimMode, VimSubMode, and VimModeChangeEvent discriminated union types, replacing any in the mode change listener.
  • Update on_mode_change test suite to assert command mode transitions.

Test plan

  • Run pnpm run typecheck to verify strict TypeScript compilation.
  • Run pnpm test to verify all 711 tests pass.
  • Verify on_mode_change passes when entering command mode with : and exiting with both y\n and <Esc>.

@oller oller changed the title Emit vim-mode-change event on command mode enter and exit (#251) feat: Emit vim-mode-change event on command mode enter and exit (#251) Oct 17, 2026
@oller

oller commented Oct 22, 2026

Copy link
Copy Markdown
Author

I think the failing workflow is unrelated. I've tried to keep this PR as succinct and non-slop as possible. Tests added, happy to revise, let me know your thoughts.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vim-mode-change not fired on command mode enter/exit

1 participant