Command reference
ed scratchpad
ed scratchpad is the command-line surface for the Scratchpad page under Mac Utilities. It lists, reads, adds, renames, pins, searches, exports, deletes and restores the notes Scratchpad keeps in tabs. The floating note window opens with Option-Command-N by default, or with ed scratchpad open.
| Command | What it does |
|---|---|
ed scratchpad ls |
Lists notes in tab order. |
ed scratchpad show |
Prints a note's Markdown. |
ed scratchpad new |
Adds a note as a new tab. |
ed scratchpad append |
Adds a line to the end of a note. |
ed scratchpad rename |
Names a tab, or clears its name. |
ed scratchpad pin |
Pins or unpins a tab. |
ed scratchpad search |
Finds notes containing every word of a query. |
ed scratchpad export |
Saves a note as a .md or .txt file. |
ed scratchpad delete |
Previews a deletion, or applies it with --yes. |
ed scratchpad undo |
Restores the most recently deleted note. |
ed scratchpad open |
Shows the floating note window. |
A NOTE argument is a note id, its position in the tab list (1 is the first tab) or its exact title, ignoring case and accents. Notes live only in Scratchpad's data folder on this Mac and are never uploaded. Each change is written to a new file that replaces the old one in a single step, and the previous save is kept as a backup, so a crash or a full disk never leaves half a note behind.
Operations
Every action the page and the floating window take is also an ed invoke operation with JSON input and output. Errors are reported as JSON on stderr.
ed invoke scratchpad scratchpad.status --json '{}'ed invoke scratchpad scratchpad.create --json '{"body":"# Groceries\n- milk"}'ed invoke scratchpad scratchpad.write --json '{"id":"NOTE-ID","body":"# Groceries\n- milk\n- eggs","revision":1}'ed invoke scratchpad scratchpad.search --json '{"query":"milk","limit":10}'ed invoke scratchpad scratchpad.export --json '{"id":"NOTE-ID","format":"txt","path":"/Users/me/Desktop"}'| Operation | Input | Result |
|---|---|---|
scratchpad.status |
{} |
Notes in tab order, the selected and most recent note, the note undo restores, settings and whether the window is open |
scratchpad.list |
{} |
Note summaries in tab order |
scratchpad.read |
{"id"}; no id reads the selected note |
The note with its Markdown body and revision |
scratchpad.create |
{"body","name"}, both optional |
The new note, selected |
scratchpad.write |
{"id","body","revision"}; revision is optional and rejects the write if the note changed |
The note with its new revision |
scratchpad.append |
{"id","text"}; no id appends to the selected note |
The note |
scratchpad.rename |
{"id","name"}; an empty or missing name clears it |
The note |
scratchpad.move |
{"id","index"}; pinned and unpinned notes stay in their own group |
Status |
scratchpad.pin |
{"id","pinned"} |
Status |
scratchpad.delete |
{"id"} |
deleted, title, undo |
scratchpad.undo |
{} |
The restored note |
scratchpad.select |
{"id"} |
Status |
scratchpad.search |
{"query","limit"} |
query and ranked results with snippet, score and matches |
scratchpad.export |
{"id","format","path","overwrite"}; format is md or txt, path is an absolute folder or file |
id, format, path |
scratchpad.layout |
{"layout"}: editor, split or preview |
Status |
scratchpad.open, scratchpad.close, scratchpad.toggle |
{} |
Status, with floating |