feat(tui): add configurable readline-style text transformations #6778
+392
−20
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.
Summary
Adds missing Emacs/Readline-style text editing shortcuts to the TUI (terminal) prompt input, improving text editing efficiency in the terminal.
Changes
New shortcuts
alt+ualt+lalt+cctrl+yctrl+tUser-facing behavior
Case transformations (
alt+u,alt+l,alt+c)Kill ring support (
ctrl+y)ctrl+k,ctrl+u,ctrl+w, andalt+ddelete commands now save deleted text to a kill bufferctrl+yinserts the contents of the kill buffer at the current cursor positionTranspose characters (
ctrl+t)Configuration
All new shortcuts are configurable via
opencode.json:{ "keybinds": { "input_lowercase_word": "alt+l", "input_uppercase_word": "alt+u", "input_capitalize_word": "alt+c", "input_yank": "ctrl+y", "input_transpose_characters": "ctrl+t" } }Note on
ctrl+tconflict:By default,
ctrl+tis bound tovariant_cycle(cycle model variants). To usectrl+tfor transpose characters, you can rebind, e.g.:{ "keybinds": { "variant_cycle": "<leader>v", "input_transpose_characters": "ctrl+t" } }Technical details
TextareaRenderablewhich has limited built-in actionsFiles
packages/opencode/src/config/config.ts- Added keybind schema entriespackages/opencode/src/cli/cmd/tui/component/prompt/index.tsx- Implemented shortcutspackages/web/src/content/docs/keybinds.mdx- Updated documentationpackages/sdk/js/src/v2/gen/types.gen.ts- Regenerated from schemapackages/opencode/test/tui/text-transform.test.ts- Added 17 tests