Skip to content

feat(comment): Alt+Enter accepts and Alt+Esc discards the vim comment#440

Merged
agavra merged 1 commit into
agavra:mainfrom
thiblahute:comment-shift-accept-discard
Jun 29, 2026
Merged

feat(comment): Alt+Enter accepts and Alt+Esc discards the vim comment#440
agavra merged 1 commit into
agavra:mainfrom
thiblahute:comment-shift-accept-discard

Conversation

@thiblahute

@thiblahute thiblahute commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

What

In the vim comment editor (comment_vim = true), a quick accept/discard with no double-press:

  • Alt+Enter (Option+Enter) → accept (save the comment)
  • Alt+Esc → discard (cancel)

This complements the existing ways to finish a comment: :w/:q, double-Enter/Esc, and Ctrl-S. The default (non-vim) comment box is unchanged — Alt+Enter stays a newline there.

Implementation

  • Handled in handle_comment_vim_key (vim box only): Alt+Entersave_comment, Alt+Escexit_comment_mode.
  • Header hint and docs/KEYBINDINGS.md updated.

Testing

cargo build, cargo fmt --check, cargo clippy --all-targets (0 warnings), cargo test (0 failures). Manually confirmed Alt+Enter saves in zellij web.

…ent box

In the vim comment editor, Alt+Enter (Option+Enter) saves the comment and
Alt+Esc cancels it directly, from any sub-mode — no double-press. Alt is the
one modified Enter/Esc that reaches the app across terminals, including
browser/web terminals like zellij web (where Shift/Cmd+Enter get stripped or
grabbed by the browser).

Plain Enter still inserts a newline in vim Insert mode, so Alt+Enter is free to
mean "accept". The default (non-vim) box is unchanged (Alt+Enter stays a
newline there). Complements the existing :w/:q, double Enter/Esc, and Ctrl-S.
@thiblahute
thiblahute force-pushed the comment-shift-accept-discard branch from 3083a67 to 0db978d Compare June 26, 2026 22:16
@thiblahute thiblahute changed the title feat(comment): accept/discard the vim comment with a modified Enter/Esc feat(comment): Alt+Enter accepts and Alt+Esc discards the vim comment Jun 26, 2026
@agavra
agavra merged commit 65d7963 into agavra:main Jun 29, 2026
4 checks passed
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.

2 participants