opencode
opencode copied to clipboard
feat(tui): add vi basic mode extension for prompt and editor
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_basicKV setting to enable/disable -
vi_basic_clip_xKV setting for clipboard behavior - Toggle via command menu
Architecture
-
PromptExtensioninterface for modular prompt extensions -
lineNumbersoption for gutter redraw (opentui workaround) - Two modes:
full(for standalone editors) andprompt(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 |