[PR #7016] feat(tui): add vi basic mode extension for prompt and editor #12207

Closed
opened 2026-02-16 18:17:08 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7016

State: closed
Merged: No


Summary

A modular vi mode implementation for the OpenCode TUI prompt with support for standalone editors.

Provides the vi extension for prompt but also for the Project Files Viewer and Editor
https://github.com/anomalyco/opencode/pull/7017

Core Features

  • Normal/insert modes with standard vi keybindings
  • Movement: h/j/k/l, w/b/e, 0/$, G, {/}, %, g{n}g, ctrl+f/b
  • Delete: x, {n}x, dd, d{n}d, dw, d{n}w, D, d$, dG, d{n}G
  • Change: cc, c{n}c, cw, c{n}w, C, s
  • Yank: yy, y{n}y, y$, yG, y%, y{, y}
  • Paste: p/P (line-wise or character-wise)
  • Multiline: o, O, J
  • Other: r, ~, ., u, ctrl+r
  • Search: /, ?, n, N (with regex support)
  • Search operators: d/, d?, c/, c?, y/, y?

Configuration

  • prompt_vi_basic KV setting to enable/disable
  • vi_basic_clip_x KV setting for clipboard behavior
  • Toggle via command menu

Architecture

  • PromptExtension interface for modular prompt extensions
  • lineNumbers option for gutter redraw (opentui workaround)
  • Two modes: full (for standalone editors) and prompt (for prompt input)

Files Changed

File Changes
lib/vi-basic-core.ts Core vi mode logic
lib/vi-basic-extension.tsx Prompt extension wrapper
lib/prompt-extension.ts Extension interface
component/prompt/index.tsx Integration
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7016 **State:** closed **Merged:** No --- ## Summary A modular vi mode implementation for the OpenCode TUI prompt with support for standalone editors. Provides the vi extension for prompt but also for the Project Files Viewer and Editor https://github.com/anomalyco/opencode/pull/7017 ## Core Features - Normal/insert modes with standard vi keybindings - Movement: `h/j/k/l`, `w/b/e`, `0/$`, `G`, `{/}`, `%`, `g{n}g`, `ctrl+f/b` - Delete: `x`, `{n}x`, `dd`, `d{n}d`, `dw`, `d{n}w`, `D`, `d$`, `dG`, `d{n}G` - Change: `cc`, `c{n}c`, `cw`, `c{n}w`, `C`, `s` - Yank: `yy`, `y{n}y`, `y$`, `yG`, `y%`, `y{`, `y}` - Paste: `p/P` (line-wise or character-wise) - Multiline: `o`, `O`, `J` - Other: `r`, `~`, `.`, `u`, `ctrl+r` - Search: `/`, `?`, `n`, `N` (with regex support) - Search operators: `d/`, `d?`, `c/`, `c?`, `y/`, `y?` ## Configuration - `prompt_vi_basic` KV setting to enable/disable - `vi_basic_clip_x` KV setting for clipboard behavior - Toggle via command menu ## Architecture - `PromptExtension` interface for modular prompt extensions - `lineNumbers` option for gutter redraw (opentui workaround) - Two modes: `full` (for standalone editors) and `prompt` (for prompt input) ## Files Changed | File | Changes | |------|---------| | `lib/vi-basic-core.ts` | Core vi mode logic | | `lib/vi-basic-extension.tsx` | Prompt extension wrapper | | `lib/prompt-extension.ts` | Extension interface | | `component/prompt/index.tsx` | Integration |
yindo added the pull-request label 2026-02-16 18:17:08 -05:00
yindo closed this issue 2026-02-16 18:17:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12207