mirror of
https://github.com/Stone-Red-Code/YesNt-Interpreter.git
synced 2026-09-04 09:06:41 +02:00
53 lines
2.1 KiB
Markdown
53 lines
2.1 KiB
Markdown
# YesNt Code Editor
|
|
|
|
`YesNt.CodeEditor` is a terminal editor for writing, formatting, running, and debugging YesNt scripts.
|
|
|
|
## Start the editor
|
|
|
|
```bash
|
|
yesntcode [optional-path-to-file.ynt]
|
|
```
|
|
|
|
If you pass a file path, it is loaded on startup.
|
|
|
|
## Modes
|
|
|
|
- **Command mode:** enter editor commands in the `>>>` prompt.
|
|
- **Edit mode:** direct text editing with keyboard navigation.
|
|
- **Debug mode:** script output/debug information while running.
|
|
|
|
## Command mode commands
|
|
|
|
| Command | Description |
|
|
| --------------------- | ------------------------------------------------------------------- |
|
|
| `edit` | Switch to edit mode |
|
|
| `line <n>` | Jump to line `n` and switch to edit mode |
|
|
| `save [path]` | Save to current path or a new path |
|
|
| `load <path>` | Load a file |
|
|
| `new` | Create new file |
|
|
| `format` | Auto-format indentation |
|
|
| `run [path]` | Save then run script (runs unsaved buffer if no path is set) |
|
|
| `debug [path] [step]` | Save then run in debug mode (`step` enables step-by-step execution) |
|
|
| `exit` | Close the editor |
|
|
|
|
## Edit mode controls
|
|
|
|
- Arrow keys: move cursor
|
|
- Enter: split line
|
|
- Backspace/Delete: remove characters/merge lines
|
|
- **Alt+C:** return to command mode
|
|
- **Alt+T:** jump to top
|
|
- **Alt+B:** jump to bottom
|
|
- **Alt+S:** jump to start of line
|
|
- **Alt+E:** jump to end of line
|
|
- **Alt+R:** run script
|
|
- **Alt+D:** run debug mode
|
|
- **Alt+F:** format current file
|
|
|
|
## Formatter behavior (quick summary)
|
|
|
|
- Indents `func`, `if`, `else`, and `while` blocks.
|
|
- Dedents on `return`, `end_func`, `end_if`, and `end_while`.
|
|
- `exit` / `throw` / `error` close active non-function blocks for following lines.
|
|
- Comment lines (`# ...`) are kept unindented.
|