Repository navigation
REPL and History
The REPL keeps language state across submitted inputs: variables, functions, methods, aliases, and module scopes remain available until the process exits. A newly installed binary takes effect in a new process, not an already-running REPL.
- Enter submits complete input; unfinished blocks continue on another line.
- Ctrl+Enter toggles manual multiline mode. Enter then inserts a newline; Ctrl+Enter again submits the buffer.
- Shift+Enter inserts a newline.
- In manual multiline mode, the prompt and continuation marker become yellow on 256-color and true-color terminals; monochrome remains uncolored.
- First Tab completes an unambiguous name or common prefix. A subsequent Tab can open the completion menu. Menu arrows navigate it; otherwise arrows edit/navigate normally.
- Ctrl+C interrupts a foreground child or discards input; Shelly remains running.
- Ctrl+D on an empty buffer exits.
For split pipeline diagrams, use manual multiline mode or paste
the complete diagram before submitting it. $SHELLY_TAB_SIZE selects the inherited
tab default; a source header #tab-size N and explicit CLI options take precedence.
$history_path: String | () defaults to ~/.shelly_history.jsonl.
$history_limit: Integer defaults to 10,000 entries. Set the path to () for
memory-only history. Configure these in the RC so the editor starts with them.
History preserves multiline submissions as entries. Sessions merge records when synchronizing rather than overwriting each other's newest commands. Blank input is not saved. If storage is unavailable or damaged, the REPL reports the problem and falls back to in-memory history rather than repeatedly disrupting the prompt.
$repl_syntax: Boolean enables highlighting. The tokenizer and parser contribute
source spans; read-only symbol information distinguishes types, methods,
functions, built-ins, aliases, commands, and argument words. For example, let
in echo let is an argument, not a declaration keyword.
Each category has a String escape setting $syntax_color_<category>:
| Categories | Default family |
|---|---|
keyword, alias, literal, builtin
|
Logo purples |
variable, number
|
Warm gold |
type, string
|
Mint/cyan |
function, method, field, module
|
Readable blues |
command, operator, format
|
Bright cyan |
argument, delimiter, comment
|
Light text and subdued grays |
escape, error
|
Peach and pink |
Settings refresh during the session and respect color capability, including monochrome. Highlighting preserves the original text and tolerates incomplete input. Analysis does not execute user code, import modules, or run commands.
Related: Prompts · Line editing · Editor integration
Begin here
Values and expressions
- Language basics
- Variables and scope
- Numbers and logic
- Strings and paths
- Arrays
- Hash maps
- Ranges and iteration
- Control flow
- Match and type guards
Functions and types
- Functions and calls
- Closures and function types
- Methods and properties
- Structs
- Enums
- Named types and unions
- Conversions
- Types and properties
Shell and modules
- Pipelines
- Pipeline splits
- Pipeline formats
- Commands and exit status
- Redirection
- Environment and exported variables
- Modules and visibility
- Nested modules and directory packages
- Conditional imports and declarations
- Errors and cleanup
- Supervised processes and terminals
Library guides
- Standard library
- The implicit prelude
- Bytes, files, readers, and writers
- Explicit item streams
- JSON documents and typed mapping
- Sockets, DNS, and TLS
- HTTP clients
- HTTP servers
- Framing, server-sent events, and JSON-RPC
- Terminal colors, styles, and geometry
- Build an application console
Interactive use