Terminal editor · written in Nyx

A real terminal editor. One Nyx file.

About 1090 lines of Nyx, a single source file, zero external dependencies — raw mode, UTF-8, live resize, mouse, bracketed paste, flicker-free rendering and 1000-level undo. Proof that Nyx builds interactive terminal apps, not just servers.

nyx-edit — server.nx
1import "std/web"
2
3fn greet(name: String) -> String {
4 return "hello, " + name
5}
6
7// heuristic highlighting, live in the buffer
8let port: int = 3000
NORMAL   server.nx   UTF-8 Ln 4, Col 20   ·   1 sel

$ curl -sSf https://nyxlang.com/install.sh | sh

~1090
lines of Nyx
1
source file
0
external dependencies
1000
undo levels
What it does

The fundamentals, done right

Everything a terminal editor needs to feel solid — the details that separate a toy from something you'd actually type in.

SIGWINCH

Live resize

Drag the terminal edge and the buffer re-renders instantly — no keypress needed to catch up.

?2026

Flicker-free rendering

One buffered write per frame inside a synchronized-output region. No tearing, no flash — even on a slow SSH link.

UTF-8

Codepoint-aware

Cursor movement, editing and rendering all work in codepoints, not bytes — 2–4 byte characters just work.

SGR mouse

Click, drag, scroll

Click to position the cursor, drag to select, wheel to scroll. Turned off cleanly on every exit path.

Ctrl+Z / Ctrl+Y

Incremental undo/redo

Per-operation deltas with typing coalescing, up to 1000 levels — a burst of typing collapses into one undo.

bracketed paste

Paste stays literal

Multiline pastes are inserted verbatim as a single undo group — no auto-indent mangling your code.

?1049

Alternate screen

Your scrollback is intact after you quit, just like vim or less. The editor lives on its own screen.

Ctrl+F / Ctrl+G

Search & go-to-line

Incremental search with wrap-around, and jump straight to a line number. The navigation you reach for.

defer cleanup

Always restores the terminal

Termios, alternate screen and mouse modes are undone via defer on every exit path — no wrecked shell after a crash.

Get it running

Install and open a file

nyx-edit is a Nyx program — install the toolchain, build the single binary, run it. No package to manage.

$ curl -sSf https://nyxlang.com/install.sh | sh
$ git clone https://github.com/nyxlang-dev/nyx-edit
$ cd nyx-edit && nyx build
$ ./nyx-edit README.md
# opens README.md — arrows to move, Ctrl+S to save, Ctrl+Q to quit
Muscle memory

Keybindings

KeyAction
ArrowsMove the cursor
Shift + ArrowsExtend selection
Ctrl + SSave file
Ctrl + QQuit
Ctrl + Z / YUndo / redo
Ctrl + FSearch (wrap-around)
Ctrl + GGo to line number
Ctrl + C / X / VCopy / cut / paste
Ctrl + KDelete current line
Home / EndStart / end of line
PgUp / PgDnPage up / down
MouseClick to position · drag to select · wheel to scroll
Why it exists

A stress test for the language

A terminal editor is unforgiving: raw byte input, escape sequences, signal handling, tight render loops. nyx-edit is one file of Nyx that does all of it — the same language that writes the compiler, the KV store and the web framework.

Build it and open a file

One clone, one build, and you're editing — with resize, mouse and undo already working.

$ git clone https://github.com/nyxlang-dev/nyx-edit
$ cd nyx-edit && nyx build
$ ./nyx-edit