|
| 1 | +--- |
| 2 | +title: "REPL" |
| 3 | +slug: "repl" |
| 4 | +description: "" |
| 5 | +date: 2026-01-01T16:52:54+02:00 |
| 6 | +lastmod: 2026-01-01T16:52:54+02:00 |
| 7 | +draft: false |
| 8 | +weight: 505 |
| 9 | +--- |
| 10 | + |
| 11 | +ArkScript REPL can be launched by calling `arkscript` without any file argument. |
| 12 | + |
| 13 | +It will look for the `ARKSCRIPT_REPL_STARTUP` environment variable to optionally preload code. See [the getting started guide](/docs/prologue/building/#environment-var-setup) to configure it. |
| 14 | + |
| 15 | +## REPL builtins |
| 16 | + |
| 17 | +- `(repl:history)` returns the REPL history as a string |
| 18 | +- `(repl:save filename)` saves the REPL history to a file |
| 19 | +- `(repl:load filename)` loads a file into the REPL (copies its content to the current session, to avoid path problems with imports) |
| 20 | + |
| 21 | +## REPL commands |
| 22 | + |
| 23 | +- `help`: display this message |
| 24 | +- `quit`: quit the REPL |
| 25 | +- `save`: save the history to disk |
| 26 | +- `history`: print saved code |
| 27 | +- `reset`: reset the VM state |
| 28 | + |
| 29 | +## REPL controls |
| 30 | + |
| 31 | +- **Home**: move to start of line |
| 32 | +- **End**: move to end of line |
| 33 | +- **Control** + **Left**: move cursor one word left |
| 34 | +- **Control** + **Right**: move cursor one word right |
| 35 | +- **Control** + **Up**: show previous hint |
| 36 | +- **Control** + **Down**: show next hint |
| 37 | +- **Control** + **U**: delete current line |
| 38 | +- **Control** + **W**: delete last word |
| 39 | +- **Control** + **K**: delete until end of line |
| 40 | +- **Control** + **R**: incremental search |
| 41 | +- **Control** + **C**: abort line |
| 42 | +- **Control** + **L**: clear screen |
| 43 | +- **Control** + **D**: send EOF, quit REPL |
| 44 | +- **Control** + **T**: transpose characters (invert the 2 characters *before* the cursor*) |
| 45 | + |
0 commit comments