curd
A tiny terminal text editor written in Rust with crossterm, built step by step as a learning project.
Package name: curd-editor (curd is taken on crates.io). Command name: curd.
Install
One command, no Rust needed. It downloads the latest release for your system.
Linux and macOS:
|
Windows (PowerShell):
irm https://raw.githubusercontent.com/vikram5258/crud-editor/main/install.ps1 | iex
Then run curd some-file.txt.
Other ways to get it:
- With Rust installed:
cargo install curd-editor - By hand: download a binary from the releases page
Run
Keys
| Key | What it does |
|---|---|
| Typing, Enter, Tab | insert text, a new line, four spaces |
| Backspace / Delete | delete before / under the cursor (joins lines at a line edge) |
| Arrows, Home, End | move the cursor; the view scrolls in both directions |
| Ctrl+S | save |
| Ctrl+Q | quit (asks for a second press if there are unsaved changes) |
curd new-file.txt starts an empty document and creates the file on the first save. The bottom row is a status bar with the file name, a [modified] marker and the cursor position.
Test
- Unit tests sit next to the code in
src/document/tests.rsandsrc/editor/tests.rs. - End-to-end tests in
tests/e2e.rsstart the realcurdin a pseudo-terminal, send keys and check the screen (Linux/macOS only).
Test files are left out of the published crate (see include in Cargo.toml).
CI runs the tests on every push and pull request and saves a JUnit test report and a coverage report as artifacts on the run. Pushing a v* tag runs the same checks first and only publishes a release (GitHub binaries, then crates.io) if they pass.
Layout
src/main.rs— starts everything upsrc/terminal.rs— raw mode, alternate screen, screen size (restored on drop)src/document.rs— the text (lines), editing it, opening and saving filessrc/editor.rs— main loop, keys, scrolling, drawing, status bar
Progress
- Step 1: raw mode, read keys, Ctrl+Q
- Step 2: draw the screen with
~and a welcome message - Step 3: open a file and show it (modular refactor)
- Step 4: cursor movement and vertical scrolling
- Step 5: typing and deleting
- Step 6: save with Ctrl+S, unsaved-changes warning, new files
- Status bar and horizontal scrolling
- Challenge: PageUp / PageDown
- Save as (name a file started without one)
- Search, syntax highlighting, undo
- LSP: diagnostics → hover → go to definition → completion