7 unstable releases (3 breaking)
Uses new Rust 2024
| new 0.4.0 | Apr 11, 2026 |
|---|---|
| 0.3.2 | Apr 8, 2026 |
| 0.3.1 | Mar 27, 2026 |
| 0.2.0 | Mar 6, 2026 |
| 0.1.1 | Feb 28, 2026 |
#91 in Text editors
1.5MB
14K
SLoC
A terminal-based text editor, built with MinUI
Redox is a terminal-based, Vim-like text editor written in Rust for my final capstone project.
NOTE: This editor is in no way associated with Redox OS.
General project structure
The code is structured as a Cargo workspace with a small, testable core logic library and a TUI front-end wrapper (built with MinUI).
The intent is to keep the editor's behaviour and data structures (buffer, indexing, edit operations, motions) independent of any particular UI, so the core logic is testable and so I can make changes to MinUI without massively breaking the editor.
redox/
├── Cargo.toml # Workspace manifest
└── crates/
├── redox-core/ # UI-agnostic editing primitives and session model
│ └── src/
│ ├── buffer/ # Rope-backed text buffer, editing, positions
│ ├── motion.rs # Vim-style motion logic
│ ├── io.rs # File read/write helpers
│ ├── session/ # Multi-buffer session management
│ └── text/ # Shared text types and helper functions
└── redox-tui/ # MinUI front-end application
└── src/
├── app/ # Editor app state + command handling
├── input/ # Key/event mapping + cursor controller
└── ui/ # Rendering and interface widgets such as the statusline
Getting Started
Requirements
- Rust toolchain (
cargo+rustc) - A terminal that supports basic ANSI features and raw mode (and ideally full colour support)
Install via CLI
The easiest way to install the editor is to just install the binary from Crates.io:
cargo install redox-editor
Build from source
Build from source after cloning the repository:
cargo build --release -p redox-editor
Then install the created binary:
cargo install --path .
This installs the redox binary into ~/.cargo/bin by default.
If needed, add that location to your PATH (example for zsh):
export PATH="$HOME/.cargo/bin:$PATH"
Usage Guide
Run Redox
redox <file_path>
Example:
redox ./README.md
Open straight into the explorer for any specified directory (including .):
redox src
Command mode quick reference
| Command | Behaviour |
|---|---|
:w |
Write current buffer |
:q |
Quit Redox (if all buffers are clean) |
:q! |
Force quit |
:wq |
Write current buffer, then quit if all buffers are clean |
:e <path> |
Open/switch buffer for a specified file path |
:bn / :bnext |
Switch to next buffer (MRU order) |
:bp / :bprev |
Switch to previous buffer (MRU order) |
:ls |
Show summary of open buffers |
:ex / :explorer |
Toggle file explorer |
:about |
Toggle the "about" popup |
Currently working Vim motions
| Keys | Behaviour |
|---|---|
h / j / k / l |
Left / down / up / right cursor motion |
w |
Move to start of next word |
b |
Move to start of previous word |
e |
Move to end of current/next word |
gg |
Jump to start of file |
G |
Jump to end of file |
i |
Insert before cursor |
I |
Insert at the start of the line |
a |
Insert after cursor |
A |
Insert at the end of the line |
o |
Insert below cursor |
O |
Insert above cursor |
v |
Visual mode |
V |
Visual line mode |
ctrl+v |
Visual block mode |
x |
Delete character under cursor |
(visual mode) x |
Delete selection without copying to register |
(visual mode) y |
Yank selection to private register |
(visual mode) c |
Change selection and enter insert mode |
(visual mode) <space>y |
Yank selection to system clipboard |
p |
Paste from private register |
P |
Paste before cursor / above line |
<space>p |
Paste from system clipboard |
(visual mode) J |
Move selection up |
(visual mode) K |
Move selection down |
(visual mode) tab |
Indent selection |
(visual mode) shift+tab |
Un-ident selection (outdent?) |
<space>e |
Toggle file explorer |
u |
Undo edit |
ctrl+r |
Redo edit |
ctrl+d |
Scroll down by one viewport |
ctrl+u |
Scroll up by one viewport |
zz |
Center cursor line in the viewport |
dd |
Delete current line |
cc |
Change current line |
yy |
Yank current line |
0 |
Go to 0th character in the line |
_ |
Go to first non-whitespace character in the line |
$ |
Go to end of the line |
D |
Delete from cursor position to end of the line |
(normal mode) r |
Replace under cursor (eg. r- replaces the cursor cell with a -) |
(visual mode) r |
Replace entire selection |
/ |
Open search to read for instances of a pattern in the current file |
f |
Move cursor on top of the closest occurrence of the specified character |
t |
Move cursor up to (before) the closest occurrence of the specified character |
Notes:
- Count prefixes are supported for motion keys (for example:
3w,5j,2G). - Compound motions are functional, such as
dapto delete a full paragraph,ci"to change a string, andd$(or justD) to delete to the end of the line. - Arrow keys are also mapped for basic directional motion.
- This is an opinionated editor, so the motions are subject to change based on my personal preferences.
Roadmap (current progress)
- Rope-backed text buffer core (
redox-core) - TUI rendering with statusline + cursor projection
- Text insertion, newline insertion, and backspace editing
- Vim-style mode system (Normal / Insert / Command)
- Core motion model with reusable UI-agnostic logic
- Unit test coverage across core and TUI state logic
- Per-buffer cursor/viewport state preservation
- File open and write flows
- Multi-buffer session architecture in core
- Buffer switching commands (
:e,:bn,:bp,:ls) - Intelligent dirty tracking (dirty clears when content returns to saved/original state)
- File explorer/picker widget
- Modify style module to use more absolute colours (RGB or something)
-
:about"About Redox" screen with version info and stuff - Relative line numbers (no standard line numbers because those are objectively worse)
- The ability to open redox into the entire current working directory with
$ redox . - Visual mode and visual line mode (with my custom line movement keybinds of shift+j/k)
- Basic session-bound undo/redo
- Syntax highlighting for...
- Rust
- Markdown
- C/C++
- Go
- Python
- Subtle colour column at col=80
- Scope indicator lines and delimiter pair highlighting
- Visual block mode
- Compound motions (like
daworci") - Basic local search (
/,f,F) - Undo tree with stored history
- More extendable leader key system with "whichkey" functionality
- A dashboard screen with similar functionality to nvim dashboards
- More Vim motions (ongoing, not marking this complete until I've caught them all!)
License
Redox is under the terms of the MIT License.
Dependencies
~14–31MB
~563K SLoC