Important
babae is currently in an experimental state. While it is designed to be a lightweight and efficient editor, it is not yet fully stable. Please be aware that bugs may occur, and there is a risk of file corruption when editing. It is recommended to use it on non-critical files and keep backups.
- Introduction
- Key Features
- Environment Setup Guide
- Global Install
- Usage Guide
- Themes
- Language Detection
- The Staircase Paste Fix
- Deep Dive: The Theory of the Terminal
- Testing
babae is a zero-dependency TUI text editor written in pure PowerShell. No NuGet packages, no compiled DLLs, no external binaries — just a single .ps1 file you can drop anywhere and run. It renders via raw ANSI escape sequences, handles input via bracketed paste mode (BPM), and speaks .editorconfig.
Its primary reason for existence: most terminal editors misbehave when pasting indented text over SSH in Bitvise (xterm-256color). babae fixes that at the input layer.
- Zero Dependencies: One file.
pwsh ./babae.ps1. Done. - SSH-Safe Paste: Bracketed paste mode (BPM) support across both interactive and redirected stdin paths. Right-click paste over SSH does not staircase — ever. See The Staircase Paste Fix.
- ANSI TUI Rendering: Low-flicker frame rendering via a shadow row buffer and direct stdout stream writes. Only changed rows are redrawn.
- Five Built-in Themes: babae dark, Catppuccin Mocha, Catppuccin Frappe, GitHub Dark, Catppuccin Latte (high contrast). Cycle with
^T. - Undo / Redo: Snapshot-based undo stack (up to 200 entries) with
^Z/^Y. - Incremental Search: Live highlighting across the buffer with
^F. - Cross-Platform Clipboard:
^C/^Vviaxclip/xsel/wl-copyon Linux (X11 and Wayland),pbcopy/pbpasteon macOS,System.Windows.Forms.Clipboardon Windows. .editorconfigSupport: Picks upindent_style,indent_size,end_of_line,trim_trailing_whitespace,insert_final_newline, andcharsetfrom the nearest.editorconfig.- Mouse Right-Click Paste on Windows: Win32 console API integration for native right-click paste events.
- Language Detection: Automatic language label in the header based on file extension (see Language Detection).
- Global Install: On first run outside
~/.babae/, babae offers to install itself globally and register ababaeshell function in your PowerShell profile.
babae requires PowerShell 7 or later.
-
Ubuntu / Debian:
sudo apt-get install -y powershell
Or follow the official Microsoft guide.
-
macOS:
brew install powershell
-
Windows: PowerShell 7 ships with modern Windows. If needed, download from github.com/PowerShell/PowerShell.
curl -O https://gitlab.com/simwai/babae/-/raw/main/babae.ps1That is the entire installation.
winget install simwai.babaeThe portable package contains the launcher, babae.ps1, and LICENSE. It requires
PowerShell 7+ on PATH.
See WINGET.md for package publishing and CI setup.
On first run, if babae detects it is not already running from ~/.babae/babae.ps1, it will prompt:
babae is not installed globally. Install to ~/.babae/babae.ps1 and add to profile? (y/n):
Answering y copies babae.ps1 to ~/.babae/ and appends a babae function to your $PROFILE, so you can launch it from anywhere with:
babae myfile.txtIf a different version is already installed, the same prompt appears offering to update it. Set $Env:BABAE_SKIP_INSTALL = 1 to suppress this check entirely.
# Open a new buffer
pwsh ./babae.ps1
# Open an existing file
pwsh ./babae.ps1 myfile.txt
# Open with a specific theme
pwsh ./babae.ps1 myfile.txt -Theme mocha| Key | Action |
|---|---|
^S |
Save |
^Q |
Quit |
^Z |
Undo |
^Y |
Redo |
^F |
Find (incremental search) |
^A |
Select all |
^C |
Copy selection (or current line) |
^V |
Paste from clipboard |
^T |
Cycle theme |
^F1 |
Help |
Arrow keys |
Move cursor |
Shift+Arrows |
Extend selection |
Home / End |
Start / end of line |
PgUp / PgDn |
Scroll by screen |
Backspace / Del |
Delete character |
Enter |
New line |
Tab |
Insert indent / autocomplete |
Esc |
Cancel search / clear selection |
RightClick |
Paste from clipboard (Windows only) |
| Flag value | Name |
|---|---|
dark (default) |
babae dark |
mocha |
Catppuccin Mocha |
frappe |
Catppuccin Frappe |
github-dark |
GitHub Dark |
latte-contrast |
Catppuccin Latte (high contrast) |
babae automatically displays a language label in the header bar based on the opened file's extension. No configuration needed.
| Extension(s) | Language |
|---|---|
.ps1, .psm1, .psd1 |
PowerShell |
.cs |
C# |
.ts, .tsx |
TypeScript |
.js, .jsx |
JavaScript |
.py |
Python |
.json, .jsonc, .jsonl |
JSON / JSONC |
.md |
Markdown |
.sh, .bash |
Bash |
.html, .htm |
HTML |
.css |
CSS |
.svg |
SVG |
.yaml, .yml |
YAML |
.toml |
TOML |
.java |
Java |
.env / *.env |
dotenv |
Dockerfile |
Dockerfile |
| (anything else) | Plain Text |
babae solves the "Staircase" bug (compound auto-indentation) using Bracketed Paste Mode (BPM).
For a deep dive into the anatomy of the bug and the technical implementation of the fix, see: 👉 STAIRCASE.md
To understand the core architecture of babae, the .NET/PowerShell APIs used, and the ANSI specifications it follows, check out the comprehensive theory guide: 👉 THEORY.md
E2E tests use Pester 5 with no Docker. Each test starts babae as a child process with stdin/stdout fully redirected, writes raw byte sequences to stdin, and verifies the output file.
# Install Pester (once)
Install-Module -Name Pester -MinimumVersion 5.0 -Force -Scope CurrentUser
# Run the suite
Invoke-Pester ./babae.tests.ps1 -Output DetailedThe suite covers:
- BPM byte-sequence helper unit tests
- Staircase regression: uniform indent, mixed indent, empty paste, 500-line large paste
- Normal key input: printable chars, Enter auto-indent, Ctrl+Z undo/redo
- Ctrl+V clipboard paste path isolation