Repository navigation
Sketchspaces and Gists
prjctimg edited this page Aug 5, 2026
·
1 revision
A sketchspace is a directory containing a p5.json manifest that p5.nvim uses to manage a p5.js project.
my-sketch/
βββ p5.json # Project configuration
βββ sketch.js # Main sketch file
βββ index.html # Generated HTML page
βββ tsconfig.json # TypeScript configuration
βββ assets/
β βββ favicon.ico
β βββ libs/
β β βββ p5.js # p5.js core library (version-cached)
β β βββ libs.js # Runtime library loader
β βββ types/
β βββ p5.d.ts # Ambient types
βββ skchbk/ # Optional: cloned gist sketches
{
"version": "2.3.1",
"mode": "global",
"libs": {},
"includes": ["sketch.js"],
"gist": {
"url": "username/gistId",
"title": "My Sketch"
}
}| Field | Description |
|---|---|
version |
p5.js version to use (v2.x) |
mode |
global or instance sketch template |
libs |
Contributor libraries to install ({ "name": "version" }) |
includes |
Files included in Gist uploads |
gist |
Gist metadata written on publish, used for sync |
flowchart LR
A["1. Create\n:P5 create"] --> B["2. Setup\n:P5 setup"]
B --> C["3. Develop\n:P5 server + :P5 cdp"]
C --> D["4. Share\n:P5 gist \"desc\""]
D --> E["5. Sync\n:P5 gist sync"]
-
Create β
:P5 create my-sketchscaffolds the skeleton and openssketch.js. Prompts forglobalvsinstancemode unlesssketch.modeis set. -
Setup β
:P5 setuphydrates runtime assets from~/.cache/p5.nvim/versionsor the CDN and installs libraries. -
Develop β
:P5 serverstarts the dev server and opens the sketch;:P5 cdpopens the debugging panel. -
Share β
:P5 gist "description"uploads theincludesfiles to a public Gist and recordsgist.url. -
Sync β
:P5 gist syncreconciles local vs remote changes.
:P5 gist "My first generative sketch"Creates a public Gist from the project's includes files. The gist URL and title are stored back into p5.json.
:P5 gist syncShows a diff of local vs remote and lets you apply local changes, pull remote changes, or skip.
:P5 gist editEdits the Gist description or the first comment (sketch notes).
A sketchbook is a local directory (skchbk/) of cloned public Gists that you can browse offline.
| Command | Action |
|---|---|
:P5 skchbk |
Interactive β clone all gists or pick one |
:P5 skchbk list |
Show locally cloned sketches and jump to one |
:P5 skchbk clone |
Clone all public Gists from the configured user |
require("p5").setup({
sketchbook = { user = "your-github-username" },
})Each clone preserves the gist link (p5.json β gist.url) so you can sync changes back with :P5 gist sync.
- Use descriptive Gist descriptions β they become directory names when cloned
- The first comment on each Gist is your sketch notes/README
-
skchbk/is excluded from Gist uploads automatically