A complete, single-file text editor written in Odin with raylib. Under 1,000 lines, zero external dependencies beyond the Odin toolchain.
- Text input (ASCII + UTF-8: Hiragana, Katakana, Latin-1, CJK symbols)
Enter,Tab(4 spaces),Backspace,Delete- Unlimited undo / redo (delta-based operation stack)
← → ↑ ↓(up/down preserves preferred column)Home/End— line start / endCtrl+Home/Ctrl+End— document start / endPageUp/PageDown
Shift+ any movement key- Mouse click + drag
Ctrl+A— select all
Ctrl+Ccopy,Ctrl+Xcut,Ctrl+Vpaste (system clipboard)
- Open file from command-line argument
Ctrl+O— open (minibuffer prompt)Ctrl+S— saveCtrl+Shift+S— save as
- Line numbers gutter
- Status bar: filename, dirty marker
*, line/column, total lines, rune count - Minibuffer prompt for Open / Save As (
Escto cancel) - Transient message line (fades to help text after 3s)
- Mouse wheel scrolling
- Resizable window
- Auto-detects a system monospace font (Menlo → SFNSMono → DejaVuSansMono → Consolas)
# macOS
brew install odin
# Or download from https://odin-lang.org/docs/install/git clone https://github.com/<your-user>/odin-editor.git
cd odin-editor
# Run directly
odin run .
# Open a file
odin run . -- path/to/file.txt
# Optimized release build
odin build . -o:speed -out:editor
./editor path/to/file.txt| Key | Action |
|---|---|
Ctrl+S |
Save |
Ctrl+Shift+S |
Save As |
Ctrl+O |
Open file |
Ctrl+Z |
Undo |
Ctrl+Y / Ctrl+Shift+Z |
Redo |
Ctrl+A |
Select all |
Ctrl+C / X / V |
Copy / Cut / Paste |
Ctrl+D |
Delete forward character |
Ctrl+Home / End |
Jump to document start / end |
Tab |
Insert 4 spaces |
Shift+<movement> |
Extend selection |
Esc (in prompt) |
Cancel Open / Save As |
Single file: main.odin (~800 LOC).
- Buffer:
[dynamic]rune— simple, correct for UTF-8. O(n) inserts but fine for typical editing sessions. - Undo/redo: pair of operation stacks. Each
Opstores the inserted/deleted runes plus cursor/anchor snapshots, so redo is free. - Selection: tracked as an anchor rune index (
-1= no selection) plus the cursor.sel_range()returns the normalized[lo, hi). - Rendering: only the visible line range is drawn each frame. Line positions are recomputed from scratch each frame — acceptable for small files, would be replaced by a line-index cache for larger ones.
- No horizontal scrolling (long lines overflow the right edge)
- CJK ideographs (
0x4E00..0x9FFF) aren't in the default codepoint atlas — extendbuild_codepoints()to include them, at the cost of a larger font texture - Full-width characters are rendered at half-width cursor columns, so Japanese-heavy lines will have a cursor-position offset
- No syntax highlighting
- Gap buffer or piece table (current
[dynamic]runeis slow on multi-MB files) - Find / replace (
Ctrl+F) - Multiple buffers / tabs
- Syntax highlighting
- Configurable keybindings
- Soft line wrap
MIT