quantum light terminal editor
  • C 98.9%
  • Shell 1.1%
Find a file
2026-03-12 17:03:23 +01:00
.gitignore rebase 2026-03-12 17:03:23 +01:00
build binary name now is zt 2025-06-08 18:45:21 +02:00
install Embed syntax highlighting and add shell support 2026-03-12 17:03:23 +01:00
LICENSE rebase 2026-03-12 17:03:23 +01:00
README.md Embed syntax highlighting and add shell support 2026-03-12 17:03:23 +01:00
zt.c Embed syntax highlighting and add shell support 2026-03-12 17:03:23 +01:00

🧬 Zepto Editor

Zepto is a quantum-sized, dependency-free text editor for the terminal.
It fits in a few kilobytes, yet supports modern editing features like:

  • Undo/Redo
  • Standard Copy/Paste
  • Text Selection
  • Syntax Highlighting
  • Line Numbers
  • Raw terminal mode for ultra-light input handling

MIT licensed, simple, fast, and perfect for minimal environments or system rescue shells.


🧠 Philosophy

Zepto was designed to be as small and portable as possible while still providing features you'd expect from a modern terminal-based editor.
No external libraries, no ncurses, no third-party build systems — just ANSI escape codes and raw TTY input.

see the wiki for details


🔧 Features

  • No dependencies: uses raw ANSI escape codes and termios
  • Raw terminal mode: captures keypresses instantly, including combinations like Ctrl/Alt/F-keys
  • Undo/Redo: based on compact history stacks
  • Clipboard: supports Ctrl+C / Ctrl+X / Ctrl+V
  • Syntax highlighting: built into the binary for supported languages
  • Compact: built binary under 30 KB
  • Mouse support: SGR mode supported. mouse wheel to scroll source and click to locate cursor
  • Portable: works on any POSIX terminal

📦 Files

  • zt.c main source file
  • build small shell script to compile the editor
  • install shell script to install the editor binary

🧾 Syntax Highlighting

Syntax highlighting is compiled directly into zt.

No external config files are required at runtime: Zepto detects supported file types from the filename extension and, for shell dotfiles, from common filenames such as .bashrc, .zshrc, and config.fish.


🎨 Terminal Graphics

Zepto draws everything using raw ANSI escape codes:

  • \033[H — move cursor to top-left
  • \033[<row>;<col>H — move cursor to a specific position
  • \033[K — clear to end of line
  • \033[7m / \033[0m — invert video (used for selections)
  • \033[?25l / \033[?25h — hide/show cursor
  • \033[41m / \033[107m — set background color (red, white, etc.)

This allows Zepto to run without ncurses, making it ideal for static builds, embedded systems, or recovery environments.


⚙️ Compilation

To compile Zepto and produce the zt binary, run:

./build

This will generate the zt executable.


🧱 Installation

To install Zepto system-wide:

./install

This copies zt into /usr/local/bin.


🖱️ Usage

zt filename.c

Controls:

  • Esc — exit without saving

  • F2 or Ctrl+2 — save

  • F10 — save and exit

  • F7 or Ctrl+7 — search

  • Ctrl+Z / Ctrl+Y — undo / redo

  • Ctrl+C / Ctrl+X / Ctrl+V — copy / cut / paste

  • Shift + Arrows — text selection


🪪 License

MIT License — see LICENSE file for details.


💡 Tip

Ideal for rescue shells, retro systems, and minimal distros.
Zepto proves you dont need megabytes of code to have modern editing pow