opencode-vim 0.0.22 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +25 -63
  2. package/assets/vim-in-motion-dialogs.gif +0 -0
  3. package/dist/tui.js +3326 -0
  4. package/docs/configuration.md +50 -400
  5. package/docs/keymap-actions.md +60 -188
  6. package/docs/vim-behavior.md +93 -0
  7. package/package.json +6 -6
  8. package/src/modules/snippets/index.tsx +0 -17
  9. package/src/modules/snippets/loader.ts +0 -147
  10. package/src/modules/snippets/search.ts +0 -118
  11. package/src/modules/snippets/skill-loader.ts +0 -81
  12. package/src/modules/snippets/state.ts +0 -40
  13. package/src/modules/snippets/trigger.ts +0 -68
  14. package/src/modules/snippets/types.ts +0 -50
  15. package/src/modules/snippets/view.tsx +0 -674
  16. package/src/modules/vim/actions.ts +0 -85
  17. package/src/modules/vim/config.ts +0 -125
  18. package/src/modules/vim/edit.test.ts +0 -51
  19. package/src/modules/vim/edit.ts +0 -33
  20. package/src/modules/vim/graphemes.ts +0 -38
  21. package/src/modules/vim/index.tsx +0 -200
  22. package/src/modules/vim/keys.ts +0 -38
  23. package/src/modules/vim/log.ts +0 -37
  24. package/src/modules/vim/map.test.ts +0 -45
  25. package/src/modules/vim/map.ts +0 -198
  26. package/src/modules/vim/state.test.ts +0 -18
  27. package/src/modules/vim/state.tsx +0 -46
  28. package/src/modules/vim/view.tsx +0 -130
  29. package/src/modules/vim/vimee.test.ts +0 -211
  30. package/src/modules/vim/vimee.ts +0 -1146
  31. package/src/plugin.tsx +0 -116
  32. package/src/prompt/host.tsx +0 -38
  33. package/src/prompt/modules.ts +0 -16
  34. package/src/prompt/root.tsx +0 -69
  35. package/src/prompt/types.ts +0 -42
  36. package/src/update.ts +0 -120
  37. package/tui.tsx +0 -275
  38. package/view.tsx +0 -29
package/README.md CHANGED
@@ -1,81 +1,43 @@
1
1
  # opencode-vim
2
2
 
3
- Vim-style editing for the OpenCode 2 prompt and dialog search fields.
3
+ Vim-style prompt editing and session navigation for OpenCode 2.
4
4
 
5
- This branch supports normal, insert, visual, and visual-line editing, custom
6
- keymaps, prompt history, command dispatch, cursor styles, and `/vim` toggling.
7
- The mode indicator appears before the working directory in the prompt footer.
8
- Pending key sequences stay hidden so they do not shift the footer layout.
5
+ ![Vim prompt editing, dialog navigation, and session mode](./assets/vim-in-motion-dialogs.gif)
9
6
 
10
- Configure the local plugin in OpenCode 2's `cli.json`:
7
+ ## Installation
11
8
 
12
- ```json
13
- {
14
- "plugins": [
15
- "opencode-vim@file:/home/dan/src/opencode-config/plugin/opencode-vim"
16
- ]
17
- }
9
+ ```sh
10
+ opencode plugin add opencode-vim@latest
18
11
  ```
19
12
 
20
- Options use the V2 object form:
21
-
22
- ```json
23
- {
24
- "package": "opencode-vim@file:/home/dan/src/opencode-config/plugin/opencode-vim",
25
- "options": {
26
- "vim": {
27
- "defaultMode": "insert",
28
- "keymapTimeout": 500,
29
- "keymaps": {
30
- "insert": { "kj": "normal" },
31
- "normal": { "Y": "y$" }
32
- }
33
- }
34
- }
35
- }
36
- ```
13
+ ## Updating
37
14
 
38
- OpenCode 2 does not yet expose its prompt ref or low-level key interceptor to
39
- plugins. This adapter uses the public renderer in the V2 plugin context to
40
- bridge those capabilities to the existing Vim engine.
15
+ ```sh
16
+ opencode plugin update opencode-vim@latest
17
+ ```
41
18
 
42
- ## Dialogs
19
+ Restart the terminal UI after updating to load the new version.
43
20
 
44
- Searchable dialogs such as `/models`, the `Ctrl+P` command palette, and Settings
45
- support Vim editing in their search fields. Each new dialog starts in your
46
- configured `defaultMode`.
21
+ ## Usage
47
22
 
48
- - In insert mode, type to filter. `Esc` (or your `kj` mapping) enters normal mode.
49
- - In normal mode, `j`/`k` move the selected list item. `h`/`l`, `x`, `dw`, `u`,
50
- and other editing commands act on the search text. `i` returns to insert mode.
51
- - `Enter` selects the highlighted item; `Esc` in idle normal mode closes or goes
52
- back. Arrows, Tab, Home/End, and Page Up/Down keep their dialog behavior.
53
- - Dialog editing has separate mode and undo state from the main prompt.
23
+ Press `Esc` to enter normal mode and `i` to type again in insert mode.
54
24
 
55
- Normal-mode custom mappings take precedence over the dialog `j`/`k` defaults.
25
+ In a session, press `s` from normal mode to browse messages and tools. Use `j`/`k`
26
+ to navigate, `Enter` to open an item, and `s` to return to the prompt.
56
27
 
57
- ## Development and testing
28
+ Use `/vim` to toggle the plugin on or off.
58
29
 
59
- ```sh
60
- npm install
61
- npm test
62
- npm run typecheck
63
- npm run bench
64
- ```
30
+ ## Development
65
31
 
66
- Tests use Bun and OpenTUI's native headless renderer: real textarea input,
67
- cursor movement, selection, wrapping, attachment extmarks, and the mounted
68
- plugin footer. They do not contact an OpenCode server or a model. When `nvim`
69
- is installed, additional tests compare text and cursor results against headless
70
- Neovim with user configuration disabled.
32
+ Run `npm ci` and `bun run build` before loading this checkout as a local plugin.
33
+ Rebuild after changing source files. The published entrypoint compiles JSX and
34
+ uses OpenCode's shared UI runtime.
71
35
 
72
- With an OpenCode source checkout and its dependencies installed, you can also
73
- test against its real dialog component and keyboard routing:
36
+ `bun run test` checks both source loading and the packed npm plugin under
37
+ `node_modules`, including mode updates, session browsing, clipboard and cleanup.
74
38
 
75
- ```sh
76
- OPENCODE_SOURCE=/path/to/opencode npm test -- test/opencode-dialog.test.tsx
77
- ```
39
+ ## Documentation
78
40
 
79
- The benchmark measures wrap mapping and normal-mode navigation on prompts of
80
- 1,000, 5,000, and 10,000 characters. Wrapping follows the textarea's visual
81
- lines; those cases are tested separately from Neovim's logical-line behavior.
41
+ - [Keybindings and modes](./docs/vim-behavior.md)
42
+ - [Configuration](./docs/configuration.md)
43
+ - [Custom keymaps](./docs/keymap-actions.md)
Binary file