opencode-vim 0.0.21 → 0.0.22
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.
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/modules/vim/{state.ts → state.tsx} +2 -0
- package/tui.tsx +0 -6
- package/view.tsx +1 -18
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ Vim-style editing for the OpenCode 2 prompt and dialog search fields.
|
|
|
5
5
|
This branch supports normal, insert, visual, and visual-line editing, custom
|
|
6
6
|
keymaps, prompt history, command dispatch, cursor styles, and `/vim` toggling.
|
|
7
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.
|
|
8
9
|
|
|
9
10
|
Configure the local plugin in OpenCode 2's `cli.json`:
|
|
10
11
|
|
package/package.json
CHANGED
package/tui.tsx
CHANGED
|
@@ -45,10 +45,8 @@ function VimHost(props: { context: Context }) {
|
|
|
45
45
|
footer.mode === "normal" ? (
|
|
46
46
|
<VimStatus
|
|
47
47
|
mode={state.mode}
|
|
48
|
-
pending={() => readablePending(state.pending())}
|
|
49
48
|
enabled={enabled}
|
|
50
49
|
theme={compatTheme(props.context)}
|
|
51
|
-
pendingDisplayDelay={config.pendingDisplayDelay}
|
|
52
50
|
/>
|
|
53
51
|
) : null,
|
|
54
52
|
})
|
|
@@ -275,7 +273,3 @@ function isCompletionToken(context: Context) {
|
|
|
275
273
|
function isArrowKey(key: string) {
|
|
276
274
|
return key === "<Left>" || key === "<Down>" || key === "<Up>" || key === "<Right>"
|
|
277
275
|
}
|
|
278
|
-
|
|
279
|
-
function readablePending(sequence: string) {
|
|
280
|
-
return sequence ? sequence.replaceAll("><", " ") : undefined
|
|
281
|
-
}
|
package/view.tsx
CHANGED
|
@@ -1,37 +1,20 @@
|
|
|
1
1
|
/** @jsxImportSource @opentui/solid */
|
|
2
2
|
import type { TextRenderable } from "@opentui/core"
|
|
3
|
-
import {
|
|
3
|
+
import type { Accessor } from "solid-js"
|
|
4
4
|
import type { VimMode } from "./src/modules/vim/state"
|
|
5
5
|
|
|
6
6
|
type VimStatusProps = {
|
|
7
7
|
mode: Accessor<VimMode>
|
|
8
|
-
pending: Accessor<string | undefined>
|
|
9
8
|
enabled: Accessor<boolean>
|
|
10
9
|
theme: {
|
|
11
|
-
info: TextRenderable["fg"]
|
|
12
10
|
success: TextRenderable["fg"]
|
|
13
11
|
warning: TextRenderable["fg"]
|
|
14
|
-
textMuted: TextRenderable["fg"]
|
|
15
12
|
}
|
|
16
|
-
pendingDisplayDelay?: number
|
|
17
13
|
}
|
|
18
14
|
|
|
19
15
|
export function VimStatus(props: VimStatusProps) {
|
|
20
|
-
const [pending, setPending] = createSignal<string>()
|
|
21
|
-
createEffect(() => {
|
|
22
|
-
const value = props.enabled() ? props.pending() : undefined
|
|
23
|
-
const delay = props.pendingDisplayDelay ?? 120
|
|
24
|
-
if (!value || delay <= 0) {
|
|
25
|
-
setPending(value)
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
const timer = setTimeout(() => setPending(value), delay)
|
|
29
|
-
onCleanup(() => clearTimeout(timer))
|
|
30
|
-
})
|
|
31
|
-
|
|
32
16
|
return (
|
|
33
17
|
<box paddingRight={1} flexDirection="row">
|
|
34
|
-
<text fg={props.theme.info}>{props.enabled() && pending() ? `${pending()} ` : ""}</text>
|
|
35
18
|
<text fg={props.mode() === "insert" ? props.theme.success : props.theme.warning}>
|
|
36
19
|
{props.enabled() ? modeLabel(props.mode()) : ""}
|
|
37
20
|
</text>
|