feat(cli): update undo/redo keybindings to Cmd+Z/Alt+Z and Shift+Cmd+Z/Shift+Alt+Z#17800
feat(cli): update undo/redo keybindings to Cmd+Z/Alt+Z and Shift+Cmd+Z/Shift+Alt+Z#17800
Conversation
Summary of ChangesHello @scidomino, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant update to the Gemini CLI's Undo and Redo keyboard shortcuts. By transitioning from Ctrl+Z to Cmd+Z/Alt+Z for Undo and Shift+Cmd+Z/Shift+Alt+Z for Redo, the CLI now offers a more intuitive and consistent editing experience, particularly for macOS users, while also resolving conflicts with standard terminal job control commands. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Size Change: +433 B (0%) Total Size: 23.5 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request successfully updates the undo/redo keybindings to be more idiomatic for macOS users (Cmd+Z/Alt+Z), while also resolving the common terminal conflict with Ctrl+Z. The changes are comprehensive, covering not only the keybinding configuration but also the necessary low-level keypress handling for special Alt key characters on macOS. The documentation, user-facing tips, and tests have all been updated consistently. The refactoring in KeypressContext.tsx to handle complex key combinations with modifiers is a solid improvement. Overall, this is a well-executed enhancement.
jacob314
left a comment
There was a problem hiding this comment.
Can we add showing a Toast when users press ctrl-Z or ctrl-shift-z as part of this PR?
That way existing users won't be confused. Make the toasts like the one shown for ctrl-C but probably tweak the timing so it shows for a couple seconds. All the toasts currently show for a bit too short a time.
0255db3 to
80fd057
Compare
| - **Undo:** | ||
| - **Keyboard shortcut:** Press **Ctrl+z** to undo the last action in the input | ||
| prompt. | ||
| - **Keyboard shortcut:** Press **Cmd+z** or **Alt+z** to undo the last action |
There was a problem hiding this comment.
Nit: mention that Alt-Z is not supported on mac.
There was a problem hiding this comment.
Eh. I figured, on mac they call it the "opt" key instead of "alt".
| setShowErrorDetails((prev) => !prev); | ||
| return true; | ||
| } else if (keyMatchers[Command.SUSPEND_APP](key)) { | ||
| handleWarning('Undo has been moved to Cmd + Z or Alt/Opt + Z'); |
There was a problem hiding this comment.
Nit: show a consistent message for redo.
There was a problem hiding this comment.
Actually, instead I will just contrinue to support ctrl+shift+Z
80fd057 to
fadb5ef
Compare
fadb5ef to
9749494
Compare

Summary
This PR updates the keyboard shortcuts for Undo and Redo in the Gemini CLI. The new shortcuts are:
Cmd + ZorAlt/Opt + ZShift + Cmd + ZorShift + Alt/Opt + ZDetails
We need to free up
Ctrl+zfor suspending.Also: Increase warning toast from 1s to 3s.
Related Issues
References #5018
How to Validate
npm startCmd + ZorAlt + Zto undo.Shift + Cmd + ZorAlt + Shift + Zto redo.npm test -w @google/gemini-cli -- src/ui/keyMatchers.test.tsPre-Merge Checklist