feat(vim): add prompt vim mode with toggle plugin#27616
Closed
m2cci-bouzentm wants to merge 1 commit into
Closed
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicates FoundPR #12679: feat(tui): vim motions in prompt input Why it might be related: This PR also implements vim motions in the prompt input, which directly overlaps with the current PR #27616's feature set (motions h/j/k/l/w/b/e/0/^/$/gg/G). Both PRs target vim keybinding support in the prompt/TUI. This could be a duplicate or a closely related effort that should be checked for overlap. |
Implements insert/normal mode, motions (h/j/k/l/w/b/e/0/^/$/gg/G), operators (x/d/c), text objects (iw/aw), find (f/t/F/T) with repeat. - SOLID split: vim.ts dispatch, vim-motion.ts, vim-keys.ts, vim-types.ts - Regression tests: 15 pass, 96 assertions - PTY E2E: 31 real terminal cases verified - Plugin toggle via vim-bindings command + vim_mode_enabled KV - Pinned to local opencode binary for E2E
629d64a to
3e9fd08
Compare
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Vim-style editing for the TUI prompt behind the existing
vim_mode_enabledKV toggle.The change keeps prompt input behavior isolated in small modules:
vim.tshandles dispatch/state transitions.vim-motion.tshandles cursor/range math.vim-keys.tsnormalizes terminal key names.vim-types.tskeeps shared prompt Vim types.Supported behavior includes insert/normal mode, common motions (
h/j/k/l,w/b/e,0/^/$,gg/G), operators (x,d,c), word text objects (iw,aw), find motions (f/t/F/T), and;/,repeat.Issue for this PR
N/A
Type of change
What does this PR do?
This adds Claude-Code-inspired Vim prompt editing to the OpenCode TUI prompt. The prompt adapter reads
vim_mode_enabledfrom KV, exposesINSERT/NORMALstatus, and delegates Vim key handling to the new prompt Vim modules.The implementation is split so motion/range logic can be tested without booting the TUI. The prompt adapter only wires TUI state, cursor movement, text replacement, and the toggle.
How did you verify your code works?
bun test test/cli/cmd/tui/prompt-vim.test.ts-> 15 pass, 96 assertions.bun run --cwd packages/opencode typecheck-> clean.opencode --versionandopencode --helpfrom the patched local launcher -> worked.Screenshots / recordings
Not included. This is terminal prompt input behavior; verification is covered by unit tests and PTY E2E.
Checklist
If you do not follow this template your PR will be automatically rejected.