feat(cli): Add W, B, E Vim motions and operator support#16209
feat(cli): Add W, B, E Vim motions and operator support#16209scidomino merged 9 commits intogoogle-gemini:mainfrom
Conversation
Summary of ChangesHello @ademuri, 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 significantly enhances the Vim mode experience within the CLI by introducing 'Big Word' navigation (W, B, E) and integrating these motions with delete and change operators. This allows users to move and manipulate text more efficiently, treating sequences of non-whitespace characters as single units, which is particularly useful for code and structured text. The changes involve core text buffer logic, UI integration, and thorough testing to ensure robustness. 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
|
There was a problem hiding this comment.
Code Review
This pull request adds support for 'Big Word' navigation (W, B, E) in Vim mode, including operator support with 'd' and 'c'. The implementation includes new helper functions for word navigation, corresponding actions in the text buffer, and updates to the Vim hook to handle the new key mappings. The changes are well-tested with new unit and integration tests.
My main feedback is a critical performance issue in the findNextBigWordAcrossLines function, which could lead to UI unresponsiveness on large files with many empty lines due to a nested loop. I've provided a comment with details on the issue and a suggestion for refactoring.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for "Big Word" navigation (W, B, E) and their corresponding operator motions in Vim mode. The implementation includes new helper functions for word navigation, updates to the text buffer actions, and integration into the useVim hook. The changes are well-supported by new unit and integration tests, and the documentation has been updated accordingly. My review identified two high-severity issues in the buffer action implementations: a correctness bug in the dW/cW behavior at the end of a line, and a maintainability concern due to redundant logic in the E motion handler. Addressing these will improve the accuracy of the Vim emulation and the long-term health of the codebase.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces "Big Word" navigation (W, B, E) and operator support (d, c) to the Vim mode, a valuable enhancement for CLI usability. The implementation is comprehensive, including new helper functions, text buffer actions, and updates to the Vim hook, all supported by new unit and integration tests. I've identified a critical bug in the empty line handling for findNextBigWordAcrossLines and a high-severity issue in findBigWordEndInLine where the logic could be simplified for better maintainability. Addressing these points will solidify this excellent feature addition.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for 'Big Word' navigation (W, B, E) in Vim mode, including operator support with 'd' and 'c'. The implementation includes new helper functions for word navigation, updates to the text buffer actions, and new key mappings in the Vim hook. The documentation and tests have also been updated accordingly. The changes are well-structured and the new feature is a great addition. I've found a couple of correctness issues with the delete/change word forward operations at the end of the buffer, where they behave like delete/change to end of line instead of operating on the word. My review includes suggestions to fix this behavior.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for 'Big Word' navigation (W, B, E) in Vim mode, including operator support (d, c). The implementation adds new helper functions for word finding, extends text buffer actions, and updates the Vim key handling logic. The changes are well-structured and include documentation and test updates. However, I've found a critical copy-paste error that causes the backward 'Big Word' motions (B, dB, cB) to behave like their small-word counterparts, which I've detailed in the comments.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces "Big Word" navigation (W, B, E) and operator support for Vim mode, which is a great enhancement. The implementation also includes several fixes and refactorings to the existing word navigation logic, improving its correctness and maintainability.
However, I've found a critical copy-paste error in the implementation of the backward "Big Word" operations (B, dB, cB). They are currently using the logic for regular words, which means they don't function as intended. Please see the detailed comments for the fix.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for 'Big Word' navigation (W, B, E) in Vim mode, including operator support. The implementation is thorough, with new helper functions, updated actions, and comprehensive tests. I've identified a couple of high-severity behavioral bugs in the new dw/cw and dW/cW implementations where they don't correctly handle cases when the cursor is on whitespace, deviating from standard Vim behavior. I've provided suggestions to align them with user expectations. The rest of the changes, including documentation updates and other fixes, look good.
|
Hi @ademuri, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
|
Hi there! Thank you for your contribution to Gemini CLI. To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md. This pull request is being closed because it is not currently linked to an issue. You can easily reopen this PR once you have linked it to an issue. How to link an issue: Thank you for your understanding and for being a part of our community! |
|
I am unable to re-open this pull request. Can someone with permissions on the repo do that, or should I open a new pull request? |
|
@scidomino would you be able to help reopen this PR for @ademuri ? |
|
Please update and point your merge to |
8e68ef0 to
83ca49d
Compare
|
I'm seeing some failing tests. Please fix. |
|
Build failed: Build process failed with link errors: |
This change adds support for "Big Word" navigation in Vim mode: - W: Move forward by big word (space-delimited). - B: Move backward by big word. - E: Move to end of big word. It also supports these motions with operators (d, c): - dW, cW, dB, cB, dE, cE. Implementation details: - Added helper functions findNextBigWordStartInLine, findPrevBigWordStartInLine, findBigWordEndInLine and their cross-line counterparts to text-buffer.ts. - Added corresponding actions to TextBuffer and vim-buffer-actions.ts. - Updated vim.ts to map keys and handle operator motions. - Added comprehensive unit tests in text-buffer.test.ts and integration tests in vim.test.tsx.
21e877c to
dc09ba1
Compare
|
Rebased, fixed the failing tests, and removed the link to the non-existent document. Some of the tests failed locally for me, but also failed at |
…i#16209) Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
…i#16209) Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
Summary
This change adds support for "Big Word" navigation in Vim mode:
- W: Move forward by big word (space-delimited).
- B: Move backward by big word.
- E: Move to end of big word.
This PR also contains fixes to the currently-broken Vim mode tests.
Closes #16768.
How to Validate
Run the Gemini CLI. Enable Vim mode in settings. Type some text, using punctuation in some of the words (e.g. "Here is some!text. Test.txt.bak i^s a word with periods."). Press
Escto enter command mode. Then, useW,E, andBto move the cursor between words. Compare the behavior with the lowercase versions.Pre-Merge Checklist