A small, dependency-free text editor for the terminal, written in C11.
Olly is a modeless editor in the spirit of nano: start typing and you're editing. It offers incremental search that wraps around the file, grouped undo/redo, automatic empty-file creation, and careful, atomic save handling. All this in a single C file with zero external dependencies.
- Modeless editing: type to insert, arrow keys to move,
Ctrlkeys act. - Search, with a case-sensitivity toggle, that wraps around the file and
remembers the last term:
Ctrl-Fsearch,Ctrl-Nnext match,Ctrl-Pprevious match, or just pressCtrl-Fagain with an empty query to repeat.Ctrl-Ttoggles between case-insensitive (the default) and case-sensitive matching.
- Search and replace:
Ctrl-Rreplaces the next match or every match, and a whole replace-all undoes or redoes as one step. - Go to line:
Ctrl-Gjumps straight to a line number. - Grouped undo/redo: a run of typed (or deleted) characters, or a
replace-all, undoes as one step.
Ctrl-Zundo,Ctrl-Yredo. - Selection and clipboard: hold
Shiftand use the arrows,Home/EndorPgUp/PgDnto select (the covered text is highlighted in reverse video);Ctrl-Ccopies,Ctrl-Xcuts andCtrl-Vpastes. Typing or deleting over a selection replaces it, and a cut or paste undoes as one step. Copy and cut also place the text on the system clipboard (OSC 52), where the terminal supports it. - Line-number gutter:
Ctrl-Utoggles a right-aligned line-number gutter behind a gray│separator (off by default); the text area narrows to make room and the cursor, horizontal scroll and wide-character alignment all follow it. - Atomic saves: the file is written to a private temporary file and
renamed into place, so an interrupted save never leaves it truncated. Line
endings (
LForCRLF), a missing final newline, and the file's mode and owner are all preserved. Files a rename would change, such as another user's or one with hard links or ACLs, are rewritten in place instead, and Olly says so. If the file changed on disk since it was opened, Olly asks before overwriting it. - Respects permissions: Olly asks before replacing a read-only file you own or overwriting an existing file with Save As. It won't replace another user's read-only file, a FIFO or a device, and offers another name instead.
- UTF-8-aware editing: the cursor,
BackspaceandDeletemove over whole characters, text round-trips as raw bytes, and display width is honoured so wide (CJK) and combining characters stay aligned on screen. - Safe paste: text pasted from your terminal is inserted as data, so control characters in it can't run commands or answer prompts (bracketed paste mode).
- Safe display: control characters and malformed UTF-8, in a file or a file
name, show as a
?instead of reaching your terminal, so opening a file can't send it commands. - Crash recovery: if a signal or an out-of-memory condition kills Olly
with unsaved changes, the buffer is written to a private recovery file under
~/.local/state/olly, and the next open offers to restore it. - Open anything: never errors on a missing file; it simply starts an empty buffer. FIFOs and devices are refused, since they may never end.
- Open-file dialog:
Ctrl-Oopens a directory browser so you can browse to a file instead of relaunching; it replaces the current buffer (unsaved changes are refused first). - Dirty-quit protection: when there are unsaved changes,
Ctrl-Qasks several times before exiting (counted down in the status bar). - Keyboard reference built in: press
Ctrl-?at any time. - No runtime dependencies. Compiles with any C11 compiler.
Just run:
makeThen put it somewhere on your PATH:
make installIts default install location is /usr/local/bin; if that directory isn't
writable (a very common situation), make install detects this and falls
back to ~/.local/bin automatically - no sudo needed. You can override the
target with make install PREFIX=/some/dir or stage a package with
make install DESTDIR=/wherever. make uninstall to remove it.
The build turns on compiler hardening (PIE, stack protection, fortified libc
calls, full RELRO). If your compiler doesn't have those flags, use make HARDEN=.
olly # start with an unnamed buffer
olly file.txt # open an existing file
olly new.txt # open a buffer for a file that doesn't exist yet
olly file.txt +42 # open with the cursor on line 42 (+42 file.txt works too)
olly --version # print the version and exitEdit immediately. Every key you type is inserted at the cursor. Save with
Ctrl-S, search with Ctrl-F, select with Shift + the arrows, and press
Ctrl-? for a key reference. Keep an eye on the status bar: it shows the file
name, line count, modified state, and the cursor as Ln <line>, Col <column>
(plus a Sel <bytes> count while text is selected). The display — including the
help screen, which reflows between one and two columns — resizes live as you
resize the terminal window.
| Key | Action |
|---|---|
Ctrl-S |
Save |
Ctrl-O |
Open a file (directory browser) |
Ctrl-Q |
Quit (asks several times with unsaved changes) |
Ctrl-F |
Search forward |
Ctrl-N |
Find next match |
Ctrl-P |
Find previous match |
Ctrl-T |
Toggle case-sensitive search |
Ctrl-R |
Search and replace (next or all) |
Ctrl-G |
Go to line |
Ctrl-C |
Copy selection |
Ctrl-X |
Cut selection |
Ctrl-V |
Paste at the cursor |
Ctrl-Z |
Undo |
Ctrl-Y |
Redo |
Ctrl-? |
Help screen |
Ctrl-L |
Repaint |
Ctrl-U |
Toggle line-number gutter |
Esc |
Cancel a prompt |
Arrows / Home / End / PgUp / PgDn |
Move around |
Shift + Arrows / Home / End / PgUp / PgDn |
Extend selection |
Enter, Backspace, Delete |
Edit (replaces any selection) |
The full write-up — including the grouped-undo rules, the fallback install
details, and the file-format notes — is in MANUAL.md.
Olly's constraints are design choices: one C file, no external dependencies, no config file, no state directories, and modeless editing. Everything Olly does should be discoverable from within the editor and readable in that one file.
There is therefore a list of things Olly deliberately does not do — not because they are hard, but because each would cost the single file, the zero dependencies, or the modelessness that define it:
- No regex. Search and replace take literal strings. Regex would mean a matching engine, as a dependency or as a second thousand-line program.
- No indentation settings.
Tabinserts a tab character, displayed at eight-column tab stops; there is no setting to convert it to spaces, no per-file indent rules, no auto-indent. - No splits, buffer lists, or multi-cursor. One terminal, one file, one cursor. Olly starts instantly, so run as many instances as you like.
- No configuration file, themes, or plugins. Olly behaves the same on every machine, which is rather the point.
- No modal editing. Nothing to learn, and no way to lose work by forgetting which mode you are in.
A few limits are practical rather than philosophical:
- Case-insensitive search and case toggling fold ASCII letters (
a–z) only; other bytes are compared exactly, so results never depend on the machine's locale. - Undo history is bounded at 32,768 steps or 16 MB of stored text, oldest first.
- One file per invocation; further file arguments are reported and ignored.
A feature request that lands on the will-not-do list above is not a bug report waiting to happen — it is a sign Olly is not the right tool for that job, and there are excellent editors that are.
Olly builds on the architecture of the classic kilo editor by antirez;
the inherited portions are credited in NOTICE.
MIT — see LICENSE.