cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

Docs: Writing a cell in Notebooks, Tab in the keys, serve-shell and nu's questions; roadmap row shipped

Dami committed c4827b3
A problem nu finds reads without color: a monochrome case for its
underline and its words on the context line.
commit
c4827b3b4313d5581711e64890c735d3f1d6d8d3
parent
9dc9f69f43c893baf5a97004207b0430a20ab947
author
Dami <dami.etoile@gmail.com>
kind
docs risk score 0.5 of 3, Jev's estimate
8 files changed, +83 -10
MROADMAP.md7+++--
Mdocs/contributing/ux.md2+-
Mdocs/nushell/notebooks.md43+++++++++++++++++++++++++++++-
Mdocs/reference/keys.md2+-
Mdocs/terminal/ssh.md4++-
Minternal/ui/monochrome_test.go23++++++++++++++++
Minternal/ui/nblang_test.go10++++++-
Minternal/ui/nbview/nu.go2+-
M ROADMAP.md +4 -3
@@ -29,12 +29,12 @@ rises in measured steps; see [Bounds of support](docs/contributing/limits.md#wha
2929 3030 Notebook tabs are a TUI Jupyter for nushell3131 ([Notebooks](docs/nushell/notebooks.md)): code and note cells, outputs in32-place, sent to sheets as live regions. What's ahead makes writing a cell33-feel like nushell's own prompt.32+place, sent to sheets as live regions, and cells highlighted, checked and33+completed by nu as they're written.3434 3535 | Item | Result | Size |3636 |---|---|---|37-| Code cells highlighted, completed and checked as you type by nushell itself: `nu --ide-ast` token shapes mapped to theme roles, `nu --ide-complete` plus 012's cell, region and sheet names on Tab, `nu --ide-check` errors underlined; debounced in the background, plain text when nu is missing or slow; hover docs through `nu --lsp` later | Writing pipelines in 012 feels like nushell's own prompt | S to M |37+| A command's signature and description for the word at the caret, on the context line, through `nu --ide-hover` or `nu --lsp` | Writing a cell without leaving for `help` | S |3838 3939 ### 3. Toward multiplayer4040
@@ -140,6 +140,7 @@ stream above rather than a design of their own.
140140 - 012 as a stage in a pipeline: `012 -` reads a table from standard input, `012 --pipe` sends the sheet or selection on, with nushell's types kept through NUON: [Pipelines](docs/nushell/pipelines.md)141141 - The `sheet` command: a nushell module shipped in the binary (`012 nu --install-module`), so nu calls 012 without `^012` or NUON on either side: [Pipelines](docs/nushell/pipelines.md#the-sheet-command)142142 - Notebook tabs, a TUI Jupyter for nushell: code and note cells with Jupyter's keys, outputs drawn in place and opened full-screen, `$name` between cells, stale marks and a reactive mode, outputs sent to sheets as live regions (`nu.name`), saved up to a cap, and earlier notebook sheets converted on open: [Notebooks](docs/nushell/notebooks.md)143+- Code cells highlighted, checked and completed as they're written by nu itself (`--ide-ast`, `--ide-check`, `--ide-complete`), in the background, falling back to 012's own when nu is missing, old, slow or not trusted: [Notebooks](docs/nushell/notebooks.md#writing-a-cell)143144 144145 **Files**145146
M docs/contributing/ux.md +1 -1
M docs/nushell/notebooks.md +42 -1
@@ -138,7 +138,7 @@ stateDiagram-v2
138138 | Enter | A new line, as indented as the one before |139139 | Up, Down, Home, End | Move by the lines on screen, wrapped lines too |140140 | Ctrl+A, Ctrl+E | The start, the end of the line |141-| Tab | Complete the word at the caret: a cell's `$name`, `$selection`, a linked file, or one of nu's commands |141+| Tab | Complete the word at the caret: a cell's `$name`, `$selection`, a linked file, then what nu completes there (commands, flags, paths); one completion goes in at once ([Writing a cell](#writing-a-cell)) |142142 143143 A terminal without the kitty keyboard protocol sends Shift+Enter and144144 Ctrl+Enter as Enter ([Keys the terminal has to tell
@@ -150,6 +150,47 @@ shortcuts (Ctrl+/), and File, Edit and the sheet tabs work as anywhere;
150150 commands for a sheet's cells are off on a notebook's tab. Changes to151151 cells are undo steps, as any edit is.152152 153+## Writing a cell154+155+The cell being written is read by nu itself, as nushell's own prompt156+reads what you type: once typing pauses, 012 asks `nu --ide-ast` what157+each word is and colors it (commands, strings, variables, numbers,158+keywords, operators; flags stay plain), and `nu --ide-check` what's159+wrong. A problem is underlined with a curly line, and with the caret on160+it the context line says what nu said:161+162+```163+ [ ] not run164+│ $files | sort-by size --revrse165+ ~~~~~~~~166+The `sort-by` command doesn't have flag `revrse`.167+```168+169+Tab asks `nu --ide-complete` too, after the notebook's own names, so it170+completes flags, subcommands and paths as well as cells and commands.171+nu doesn't know the variables a notebook binds, so it's asked about the172+cell with `$name` for each named cell and linked file, `$selection` and173+`$sheet` declared before it; a `$sheet.A1:C9` range reads as one174+variable, and `name =` isn't part of what nu reads.175+176+Questions to nu run in the background and never on each key: one177+process for each question after a pause, at most two at a time, each178+stopped once the text changes and after a second and a half. Until nu179+answers, the cell shows 012's own highlighting, and what's unchanged180+keeps nu's colors, so nothing flickers or moves. 012 falls back to its181+own highlighting and names, without saying so, when:182+183+- nu isn't installed, or is older than 0.100;184+- nu timed out three times in a row (asked again in the next session);185+- the cells couldn't run without asking: a file from another computer186+ not yet trusted ([Saving and trust](#saving-and-trust)), `shell =187+ off`, or [012 serve](../terminal/ssh.md#notebooks) without188+ `serve-shell`.189+190+nu reads the cell without your `config.nu` or its standard library, so191+your own commands aren't known to it; they still run when the cell does192+with `nu-config`.193+153194 ## Running154195 155196 Cells run in the background, one at a time, so the screen stays live:
M docs/reference/keys.md +1 -1
M docs/terminal/ssh.md +3 -1
M internal/ui/monochrome_test.go +23 -0
M internal/ui/nblang_test.go +8 -2
M internal/ui/nbview/nu.go +1 -1