Skip to content

Concept: Try a calculator in tmux from Lua or Neovim - #151

Merged
tony merged 3 commits into
masterfrom
concept-calculator-quickstart
Dec 6, 2026
Merged

tony merged 3 commits into
masterfrom
concept-calculator-quickstart

Conversation

@tony

@tony tony commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Try it

A Lua example opens a private tmux pane, types 19 + 23, and waits for the calculator to answer. Run it in Neovim with 7 + 8 to see 7 + 8 = 15 in :messages.

$ git clone --branch concept-calculator-quickstart https://github.com/libtmux/libtmux-lua.git

From that checkout, follow the shell or Neovim instructions at the top of the README. The shell recipe builds the SCM rock with Runtime:start_server. The calculator uses live pane output and needs tmux 3.7 or newer. The README also gives a screen-reading example for tmux 3.3a through 3.6b and a pure query for the published rock. Quick start

Standalone Lua uses the luv module. The README names the build tools for Debian, Ubuntu, Fedora and macOS. If you switch to Ubuntu or Debian’s Lua and its lua-luv package, a new terminal and matching LuaRocks setup let the calculator load that module.

What changed

The calculator waits for the complete answer line and validates the arithmetic. Both sends and the reply share a five-second deadline. The package gate runs the installed example with incorrect and silent workers and checks private-server cleanup.

The original watch example could accept its own terminal echo. The earlier package fixture also failed when the worker's Lua variable was renamed without changing the example's behavior. The updated fixture supplies a worker through the test process's private PATH.

Test plan

  • Run the full outer gate with Lua 5.5.1, tmux 3.8 and Neovim 0.12.5 on Linux ARM64 (77 s).
  • Run the installed example with an incorrect reply and a silent worker. Both fail and clean up the private server.
  • Run the runtime suite with Lua 5.1.5, tmux 3.3a and Neovim 0.10.0. The control-mode calculator is skipped at this tmux version.
  • Build the SCM rock with Ubuntu’s Lua 5.4.6 and its lua-luv package. The installed example prints 19 + 23 = 42 on tmux 3.8.
  • Install the private 0.1.2-1 candidate and run the calculator in Lua and Neovim. Ubuntu’s Lua 5.4 with its lua-luv package also printed 19 + 23 = 42 from that candidate.
  • Run GitHub's required CI on the updated branch.

Refs #108, #84 and #51.

@tony tony added documentation Improvements or additions to documentation area:examples Runnable examples, their published output, and the public showcase. p1 High impact on a core workflow or a repeatably failing required check. topic:examples Worked examples, sample applications, and user guides. labels Dec 5, 2026
@tony
tony deployed to docs-preview December 5, 2026 01:49 — with GitHub Actions Active
@tony
tony force-pushed the concept-calculator-quickstart branch from 2a1733d to 26801f4 Compare December 5, 2026 23:13
tony added 3 commits December 6, 2026 08:35
why:
Typing into a pane can produce a terminal echo before the program
reads the input. Readers need an answer they can verify.

what:
- Show how to run the calculator from standalone Lua and Neovim.
- Check the answer under one deadline and exercise failure and cleanup.
why:
The first live example now starts an interactive program in tmux.

what:
- Note how standalone Lua and Neovim can try the calculator.
why:
The checkout examples require owned servers, and the package controls
need to exercise the program the reader actually runs.

what:
- Build the SCM rock in the quick start and keep a published-rock query.
- Run the checkout examples against an isolated SCM installation.
- Drive wrong and silent replies without editing the example source.
@tony
tony force-pushed the concept-calculator-quickstart branch from 26801f4 to ae13fa5 Compare December 6, 2026 14:35
@tony
tony marked this pull request as ready for review December 6, 2026 14:52
@tony
tony merged commit 5763344 into master Dec 6, 2026
13 of 14 checks passed
@tony
tony deleted the concept-calculator-quickstart branch December 6, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:examples Runnable examples, their published output, and the public showcase. documentation Improvements or additions to documentation p1 High impact on a core workflow or a repeatably failing required check. topic:examples Worked examples, sample applications, and user guides.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant