PlotQL includes an interactive terminal interface built with Textual. It provides a harlequin-inspired experience for writing and executing queries.
- Multi-line query editor with syntax highlighting
- Live plot preview using Sixel rendering
- Autocomplete for keywords, functions, and column names
- Query persistence between sessions
- Connector configuration editor
# Interactive mode
plotql
# Execute a query directly
plotql -c "WITH source('data.csv') PLOT price AGAINST time"
# Run a .pql file
plotql query.pql
# Save output
plotql -c "..." -o chart.png| Key | Action |
|---|---|
F5 |
Execute query |
F2 |
Open connector config editor |
Ctrl+Q |
Quit |
Ctrl+Space |
Trigger autocomplete |
Tab |
Accept autocomplete suggestion |
Escape |
Dismiss autocomplete popup |
Ctrl+A |
Select all text |
┌─────────────────────────────────────┐
│ Header │
├─────────────────────────────────────┤
│ │
│ Query Editor (30%) │
│ │
├─────────────────────────────────────┤
│ │
│ │
│ Plot Preview (remaining space) │
│ │
│ │
├─────────────────────────────────────┤
│ Status Bar │
├─────────────────────────────────────┤
│ Footer (keybindings) │
└─────────────────────────────────────┘
The editor supports:
- PlotQL syntax highlighting via tree-sitter
- Auto-indentation (2 spaces)
- Autocomplete triggered by typing
Completions appear as you type:
- Keywords:
WITH,PLOT,AGAINST,AS,FILTER,FORMAT,AND,OR - Functions:
count,sum,avg,min,max,median - Plot types:
scatter,line,bar,hist - Column names: Loaded from the data source after
PLOTorFILTER
Use Tab to accept a suggestion, Up/Down to navigate, Escape to dismiss.
Plots render using Sixel graphics for high-quality terminal display. Supported in:
- VS Code terminal
- iTerm2
- WezTerm
- Kitty
- mlterm
The plot auto-sizes to fill available space.
Shows query status:
- Ready: Waiting for query
- OK: Successful execution with row counts
- Error: Parse or execution errors (truncated if long)
Press F2 to open the connector config editor. This edits ~/.config/plotql/sources.toml.
Example configuration:
[trades]
type = "file"
path = "/data/trades.csv"
[local_data]
type = "folder"
path = "/data/market"
[my_database]
type = "clickhouse"
host = "localhost"
database = "analytics"See Connectors for detailed configuration options.
The TUI automatically saves your query when you quit and restores it on next launch. State is stored in ~/.config/plotql/state.json.
Debug logs are written to plotql.log in the current directory. Useful for troubleshooting rendering or autocomplete issues.
The TUI uses a dark vaporwave-inspired theme with:
- Dark background (
#0a0a0f) - Soft pastel syntax colors
- High contrast for readability
The theme is defined in plotql/themes/ and applied consistently across the editor, plot rendering, and UI elements.