From aa4c294eaa8a2c001889acafc804f45e7c07b696 Mon Sep 17 00:00:00 2001 From: Brett Kulp Date: Wed, 20 May 2026 17:02:50 -0500 Subject: [PATCH] make static html site and build script --- AGENTS.md | 1 + docs/README.md | 11 ++ docs/build.ts | 109 ++++++++++++++++ docs/index.html | 322 ++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 5 files changed, 444 insertions(+) create mode 100644 docs/README.md create mode 100644 docs/build.ts create mode 100644 docs/index.html diff --git a/AGENTS.md b/AGENTS.md index 0b1998ec5012..5e17abf7ff32 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,4 +1,5 @@ - To regenerate the JavaScript SDK, run `./packages/sdk/js/script/build.ts`. +- To regenerate the GitHub Pages site from README.md, run `bun run build:site`. - ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE. - The default branch in this repo is `dev`. - Local `main` ref may not exist; use `dev` or `origin/dev` for diffs. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000000..b69a34a176fb --- /dev/null +++ b/docs/README.md @@ -0,0 +1,11 @@ +# Site + +GitHub Pages site for opencode-vim. + +To regenerate from README.md (run from repo root): + +``` +bun run build:site +``` + +This runs `site/build.ts` which converts `README.md` to `site/index.html` using `marked`. diff --git a/docs/build.ts b/docs/build.ts new file mode 100644 index 000000000000..933a2c30f339 --- /dev/null +++ b/docs/build.ts @@ -0,0 +1,109 @@ +#!/usr/bin/env bun +import { marked } from "marked" + +const RAW = "https://raw.githubusercontent.com/leohenon/opencode-vim/ocv" + +const head = ` + + + + + OpenCode-Vim — OpenCode fork with a vim mode + + + + + + + + + + + + + + + +
+
+

OpenCode Vim

+

An OpenCode fork with a built-in vim mode. Syncs with upstream OpenCode releases.

+

Adds a comprehensive + Vim mode, so you can navigate, edit text, and control your AI coding + assistant with the familiarity of Vim. If you have been missing Vim while using Opencode, this fixes that.

+ +
+ + + OpenCode-Vim demo` + +const foot = ` +
+ +` + +const readme = await Bun.file("README.md").text() +marked.use({ gfm: true }) + +const idx = readme.indexOf("## ") +const body = await marked.parse(idx !== -1 ? readme.slice(idx) : readme) +const html = body + .replace(/src="\.github\//g, `src="${RAW}/.github/`) + .replace(/href="\.github\//g, `href="${RAW}/.github/`) + .replace(/\[!NOTE\]/g, "Note:") + .replace(/\[!TIP\]/g, "Tip:") + +await Bun.write("docs/index.html", head + "\n\n" + html + "\n\n" + foot) +console.log("Generated docs/index.html from README.md") diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 000000000000..20bbc25d88f7 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,322 @@ + + + + + + OpenCode-Vim — OpenCode fork with a vim mode + + + + + + + + + + + + + + + +
+
+

OpenCode Vim

+

An OpenCode fork with a built-in vim mode. Syncs with upstream OpenCode releases.

+

Adds a comprehensive + Vim mode, so you can navigate, edit text, and control your AI coding + assistant with the familiarity of Vim. If you have been missing Vim while using Opencode, this fixes that.

+ +
+ + + OpenCode-Vim demo + +

Install

+
# npm
+npm i -g @leohenon/ocv
+
+# Homebrew
+brew install leohenon/tap/ocv
+
+# curl
+curl -fsSL https://raw.githubusercontent.com/leohenon/opencode-vim/ocv/install.sh | sudo sh
+
+

Usage

+
ocv
+
+

Update

+
# npm
+npm i -g @leohenon/ocv@latest
+
+# Homebrew
+brew upgrade ocv
+
+# built-in updater
+ocv update
+
+

Features

+

Vim motions

+

Toggle via command palette (Ctrl+p -> Toggle vim mode).

+
+

Unicode word boundaries are not supported.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CategoryKeys
Character / wordh, j, k, l, w, b, e, W, B, E
Line / buffer0, ^, _, $, gg, G
Matching / paragraph%, {, }
Find / tillf, F, t, T, ;, ,
ScrollCtrl+e, Ctrl+y, Ctrl+d, Ctrl+u, Ctrl+f, Ctrl+b
Insert / replacei, I, a, A, o, O, R
Character / line editr, x, ~, s, S, J, C, dd, cc
Word changescw, cb, ciw, caw, ciW, caW
Word deletesdw, db, diw, daw, diW, daW
Quote changesci", ca", ci', ca', ci` , ca`
Quote deletesdi", da", di', da', di` , da`
Bracket changesci(, ca(, ci[, ca[, ci{, ca{, ci<, ca<
Bracket deletesdi(, da(, di[, da[, di{, da{, di<, da<
Find / till operatorscf, cF, ct, cT, df, dF, dt, dT
Matching / paragraph operatorsc%, d%, c}, c{, d}, d{
Line / word yanksyy, yw, yiw, yaw, yiW, yaW
Quote yanksyi", ya", yi', ya', yi` , ya`
Bracket yanksyi(, ya(, yi[, ya[, yi{, ya{, yi<, ya<
Matching / paragraph yanksy%, y}, y{
Put / undo / repeatp, P, u, Ctrl+r, .
Visual selectionv, V
+
+

Note: +<leader>y copies the prompt selection when present; configure it with keybinds.prompt_copy_selection. +For clipboard sync, see System clipboard register.

+
+

Anthropic OAuth

+

Claude subscriptions built-in with /connect. No plugins or configuration needed.

+

Copy Mode

+

Text selection from the chat session view.

+
+

Copy mode collapses code diffs into a single column for easy copying.

+
+ +
+

Tip: +Configure the entry key with keybinds.copy_mode.

+
+

Prompt Input

+

Prompt input height is configurable with prompt_max_height in tui.json.

+

A scrollbar appears when the prompt exceeds the visible area. gg / G focus the prompt input when typing.

+
{
+  "prompt_max_height": 35,
+  "prompt_scrollbar": true
+}
+
+
+

Setting prompt_max_height above 40 is not recommended.

+
+

Minimal UI

+

Hides extra UI hints and tips.

+ + + + + + + + + + + +
DefaultMinimal
+

Toggle via command palette (Ctrl+p -> Toggle minimal ui).

+

Configuration

+

Submit behavior

+

By default, vim insert mode keeps Enter for newlines and normal mode uses Enter to submit. If you want Enter to submit from insert mode too, add this to tui.json:

+
{
+  "vim_enter_submit": true
+}
+
+

When vim_enter_submit is enabled, line returns are still available through input_newline.

+
{
+  "keybinds": {
+    "input_newline": "alt+return"
+  }
+}
+
+

If you keep vim_enter_submit disabled but want a separate submit key that works from insert mode, configure input_force_submit:

+
{
+  "keybinds": {
+    "input_force_submit": "alt+return"
+  }
+}
+
+

By default, input_force_submit is unbound.

+

System clipboard register

+

By default, vim mode uses an internal register for y and p. If you want yank and paste to use the system clipboard instead, add this to tui.json:

+
{
+  "vim_system_clipboard_register": true
+}
+
+

With this enabled, yank operations sync to the system clipboard and p / P paste from it.

+
+

Note: +Terminal/OS clipboard shortcuts don’t preserve Vim linewise register state. External clipboard text is pasted as characterwise text.

+
+

Neovim integration

+

Compatible with opencode.nvim. Use the following server config:

+
local ocv_cmd = "bash -c 'exec -a opencode ocv --port'"
+
+vim.g.opencode_opts = {
+  server = {
+    start = function()
+      require("opencode.terminal").open(ocv_cmd)
+    end,
+    toggle = function()
+      require("opencode.terminal").toggle(ocv_cmd)
+    end,
+  },
+}
+
+

Feedback

+

Have a suggestion? Open an issue.

+

Contributors

+

Thanks to everyone who contributed.

+

+ + + +
+ + \ No newline at end of file diff --git a/package.json b/package.json index c4bd48684062..0c1c433c35a1 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "prepare": "husky", "random": "echo 'Random script'", "hello": "echo 'Hello World!'", + "build:site": "bun run docs/build.ts", "test": "echo 'do not run tests from root' && exit 1" }, "workspaces": {