From 3c3792d19b09431454251cf4ce5010bbf0ac2dff Mon Sep 17 00:00:00 2001 From: David Ollerhead Date: Tue, 17 Mar 2026 21:51:13 +0000 Subject: [PATCH 1/2] fix: generate complete command descriptions in vimsplain README table --- .changeset/curly-tables-jump.md | 6 ++ packages/vimsplain/README.md | 84 +++++++++---------- .../vimsplain/scripts/gen-commands-table.ts | 4 +- 3 files changed, 50 insertions(+), 44 deletions(-) create mode 100644 .changeset/curly-tables-jump.md diff --git a/.changeset/curly-tables-jump.md b/.changeset/curly-tables-jump.md new file mode 100644 index 0000000..698ff14 --- /dev/null +++ b/.changeset/curly-tables-jump.md @@ -0,0 +1,6 @@ +--- +"vimsplain": patch +--- + +fix: handle nested quotes in command descriptions for README generation + diff --git a/packages/vimsplain/README.md b/packages/vimsplain/README.md index 79e9c01..220ae04 100644 --- a/packages/vimsplain/README.md +++ b/packages/vimsplain/README.md @@ -160,10 +160,10 @@ SPECIAL_KEYS.CTRL_I // "[C-i]" | `"\+yy` | yank line to system clipboard | | `"\+p` | paste from system clipboard after cursor | | `"\+P` | paste from system clipboard before cursor | -| `"(a)yy` | yank line into register | -| `"(a)dd` | delete line into register | -| `"(a)p` | paste from register | -| `"(a)P` | paste from register | +| `"(a)yy` | yank line into register '$1' | +| `"(a)dd` | delete line into register '$1' | +| `"(a)p` | paste from register '$1' after cursor | +| `"(a)P` | paste from register '$1' before cursor | | `d$` | delete to end of line | | `d0` | delete to start of line | | `d^` | delete to first non-blank | @@ -174,10 +174,10 @@ SPECIAL_KEYS.CTRL_I // "[C-i]" | `dNe` | delete to end of $1 word(s) | | `dNj` | delete $1 line(s) down | | `dNk` | delete $1 line(s) up | -| `df(.)` | delete through | -| `dF(.)` | delete back through | -| `dt(.)` | delete till | -| `dT(.)` | delete back till | +| `df(.)` | delete through '$1' | +| `dF(.)` | delete back through '$1' | +| `dt(.)` | delete till '$1' | +| `dT(.)` | delete back till '$1' | | `dd` | delete line | | `Ndd` | delete $1 lines | | `D` | delete to end of line | @@ -187,10 +187,10 @@ SPECIAL_KEYS.CTRL_I // "[C-i]" | `cNw` | change $1 word(s) forward | | `cNb` | change $1 word(s) backward | | `cNe` | change to end of $1 word(s) | -| `cf(.)` | change through | -| `cF(.)` | change back through | -| `ct(.)` | change till | -| `cT(.)` | change back till | +| `cf(.)` | change through '$1' | +| `cF(.)` | change back through '$1' | +| `ct(.)` | change till '$1' | +| `cT(.)` | change back till '$1' | | `cc` | change entire line | | `C` | change to end of line | | `S` | substitute entire line | @@ -199,19 +199,19 @@ SPECIAL_KEYS.CTRL_I // "[C-i]" | `y0` | yank to start of line | | `y^` | yank to first non-blank | | `yNw` | yank $1 word(s) forward | -| `yf(.)` | yank through | -| `yF(.)` | yank back through | -| `yt(.)` | yank till | -| `yT(.)` | yank back till | +| `yf(.)` | yank through '$1' | +| `yF(.)` | yank back through '$1' | +| `yt(.)` | yank till '$1' | +| `yT(.)` | yank back till '$1' | | `yy` | yank line | | `Y` | yank line | | `Nyy` | yank $1 lines | | `ciw` | change inner word | | `caw` | change a word (with space) | -| `ci"` | change inside | -| `ca"` | change around | -| `ci'` | change inside | -| `ca'` | change around | +| `ci"` | change inside "" | +| `ca"` | change around "" | +| `ci'` | change inside '' | +| `ca'` | change around '' | | `ci(` | change inside () | | `ci)` | change inside () | | `ca(` | change around () | @@ -228,10 +228,10 @@ SPECIAL_KEYS.CTRL_I // "[C-i]" | `cat` | change around tag | | `diw` | delete inner word | | `daw` | delete a word (with space) | -| `di"` | delete inside | -| `da"` | delete around | -| `di'` | delete inside | -| `da'` | delete around | +| `di"` | delete inside "" | +| `da"` | delete around "" | +| `di'` | delete inside '' | +| `da'` | delete around '' | | `di(` | delete inside () | | `di)` | delete inside () | | `da(` | delete around () | @@ -248,20 +248,20 @@ SPECIAL_KEYS.CTRL_I // "[C-i]" | `dat` | delete around tag | | `yiw` | yank inner word | | `yaw` | yank a word (with space) | -| `yi"` | yank inside | -| `ya"` | yank around | -| `yi'` | yank inside | -| `ya'` | yank around | +| `yi"` | yank inside "" | +| `ya"` | yank around "" | +| `yi'` | yank inside '' | +| `ya'` | yank around '' | | `yi(` | yank inside () | | `yi)` | yank inside () | | `ya(` | yank around () | | `ya)` | yank around () | | `viw` | select inner word | | `vaw` | select a word (with space) | -| `vi"` | select inside | -| `va"` | select around | -| `vi'` | select inside | -| `va'` | select around | +| `vi"` | select inside "" | +| `va"` | select around "" | +| `vi'` | select inside '' | +| `va'` | select around '' | | `vi(` | select inside () | | `va(` | select around () | | `vi)` | select inside () | @@ -300,10 +300,10 @@ SPECIAL_KEYS.CTRL_I // "[C-i]" | `ya`` | yank around `` | | `vi`` | select inside `` | | `va`` | select around `` | -| `f(.)` | find | -| `F(.)` | find | -| `t(.)` | till | -| `T(.)` | till | +| `f(.)` | find '$1' forward | +| `F(.)` | find '$1' backward | +| `t(.)` | till '$1' forward | +| `T(.)` | till '$1' backward | | `;` | repeat last f/t/F/T | | `,` | repeat last f/t/F/T reverse | | `Nw` | move $1 words forward | @@ -349,7 +349,7 @@ SPECIAL_KEYS.CTRL_I // "[C-i]" | `Nx` | delete $1 chars | | `x` | delete char under cursor | | `X` | delete char before cursor | -| `r(.)` | replace with | +| `r(.)` | replace with '$1' | | `R` | enter replace mode | | `~` | toggle case | | `J` | join lines | @@ -363,13 +363,13 @@ SPECIAL_KEYS.CTRL_I // "[C-i]" | `v` | enter visual mode | | `V` | enter visual line mode | | `[C-v]` | enter visual block mode | -| `m(.)` | set mark | -| `'(.)` | go to mark | -| ``(.)` | go to mark | -| `q(a)` | start recording macro | +| `m(.)` | set mark '$1' | +| `'(.)` | go to mark '$1' (line) | +| ``(.)` | go to mark '$1' (exact) | +| `q(a)` | start recording macro '$1' | | `q` | stop recording macro | | `@@` | replay last macro | -| `@(a)` | play macro | +| `@(a)` | play macro '$1' | | `n` | next search match | | `N` | previous search match | | `\*` | search word under cursor forward | diff --git a/packages/vimsplain/scripts/gen-commands-table.ts b/packages/vimsplain/scripts/gen-commands-table.ts index 93e584d..c4438b8 100644 --- a/packages/vimsplain/scripts/gen-commands-table.ts +++ b/packages/vimsplain/scripts/gen-commands-table.ts @@ -29,13 +29,13 @@ const block = normalCommandsMatch[0]; const entries: Array<{ keystroke: string; description: string }> = []; const entriesRaw = [ ...block.matchAll( - /\{[^}]*pattern:\s*\/\^?([^/]+)\/[^}]*description:\s*['"]([^'"]+)['"]/gs, + /\{[^}]*pattern:\s*\/\^?([^/]+)\/[^}]*description:\s*(["'])(.*?)\2/gs, ), ]; for (const match of entriesRaw) { const rawPattern = match[1]; - const description = match[2]; + const description = match[3]; // Clean up the pattern for display let keystroke = rawPattern From badd9ddc7f8d0f55c1e19042e227008e7af43510 Mon Sep 17 00:00:00 2001 From: David Ollerhead Date: Tue, 17 Mar 2026 22:15:35 +0000 Subject: [PATCH 2/2] docs: add link to README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 19a5c80..e58e269 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ pnpm dev # Start development server ## vimsplain -Parse and explain Vim keystroke sequences. Available as a standalone npm package. +Parse and explain Vim keystroke sequences. Available as a standalone [npm package](https://www.npmjs.com/package/vimsplain). ```ts import { explainSequence, summarizeSequence } from "vimsplain";