Croft is a three‑pane, VS Code‑inspired terminal UI written in Rust. It combines a file explorer, a tree‑sitter powered editor, and an embedded shell, while adding modern IDE features such as LSP support, fuzzy file search, and inline image/PDF previews, all delivered as a single static binary.
Croft – A VS Code‑Style TUI Built in Rust

Thesis
Croft aims to recreate the full‑featured experience of Visual Studio Code inside a terminal, but without the heavyweight Electron runtime. By leveraging Rust’s performance, a static binary, and a carefully composed stack of terminal‑friendly libraries, it offers developers a responsive, keyboard‑centric workspace that runs on macOS and Linux.
Core Arguments
1. Architecture that respects the terminal’s constraints
- Three‑pane layout – A draggable sidebar (Explorer, Search, Remote), a central editor, and a bottom terminal pane. The splitters are rendered with ratatui and crossterm, allowing pixel‑perfect resizing without redrawing the entire UI.
- Embedded PTY – Using portable‑pty the application spawns a real
$SHELLon a pseudoterminal. A background thread parses the stream with vt100, turning every cell into a styledratatuiwidget. This means tools likevim,htop, or any interactive CLI behave exactly as they would in a native terminal. - Static binary – All dependencies are compiled into a single executable, eliminating the need for a runtime like Node.js. The result is a fast start‑up time and a predictable deployment model.
2. Feature set that mirrors VS Code
| Feature | Implementation Details |
|---|---|
| File Explorer | Built on ignore::WalkBuilder with .gitignore awareness; lazy loading of directory entries; multi‑select, drag‑and‑drop, cut/copy/paste, and OS trash integration. |
| Fuzzy Quick‑Open (Cmd/Ctrl + P) | A dedicated FileFinder widget stores an Arc<Vec<FileEntry>>. Scoring uses a greedy subsequence algorithm with word‑boundary bonuses, filename bonuses, and a length normaliser, delivering O(N) per‑keystroke performance without allocations. |
| Search Sidebar | Live, .gitignore‑aware substring search capped at 200 results; toggles for case‑sensitivity, whole‑word, and regex. |
| Editor | Tree‑sitter provides incremental, AST‑based syntax highlighting for dozens of languages. Inline preview tabs render PNG/JPEG/GIF/BMP/WebP, PDFs (via poppler or macOS sips), and spreadsheets (via calamine). Clipboard interactions use OSC 52. |
| LSP Integration | An async client stack (tokio + async‑lsp) offers hover signatures, go‑to‑definition (Cmd‑click), and completion pop‑ups. Supported servers include rust‑analyzer, basedpyright, ruff, and others. |
| Remote (SSH) Explorer | Reads ~/.ssh/config, launches a new Croft instance over SSH, and displays a hero illustration using iTerm2’s OSC 1337 image protocol. |
| Keybinding Consistency | Global shortcuts (Ctrl+S, Ctrl+Q, F1, Ctrl+Shift+J, etc.) are modeled after VS Code. macOS‑specific Cmd bindings are enabled through an iTerm2 setup script that rewrites Cmd‑letter to the corresponding control byte. |
3. Thoughtful handling of terminal quirks
- OSC 1337 image clearing – When the Quick‑Open modal appears, Croft temporarily disables image rendering to prevent stray cached cells from bleeding into the overlay. This is achieved by a one‑shot
terminal.clear()that is chained into the driver’s eviction pipeline. - Bracketed paste vs. CSI‑u – The file finder accepts both the standard bracketed‑paste payload and the CSI‑u sequence used by iTerm2 and other Kitty‑protocol terminals. The implementation strips control characters (
\n,\t,\r) so copied filenames paste cleanly. - Cmd‑key mapping on macOS – Because macOS reserves Cmd for application menus, Croft provides a helper (
setup-iterm2) that writes the necessary key mappings into the iTerm2 plist, ensuring shortcuts like Cmd + P open the Quick‑Open modal rather than the system Print dialog.
4. Development ergonomics
- Single‑command installation –
cargo install --git https://codeberg.org/vitali87/croft.gitbuilds and places the binary in~/.cargo/bin. Re‑running the command upgrades the tool. - Extensive test suite – Over 568 unit tests and integration tests cover widget rendering, fuzzy scoring, key routing, and iTerm2 plumbing, guaranteeing stability across platforms.
- Modular code layout – The repository separates concerns cleanly:
src/widgets/for UI components,src/lsp/for language‑server logic, andsrc/remote.rsfor SSH handling. This makes future extensions (e.g., a plugin system) straightforward.
Implications
Croft demonstrates that a fully‑featured IDE need not rely on heavyweight frameworks. By staying within the terminal, it inherits the low‑latency input model, easy remote deployment (SSH works out of the box), and the ability to chain multiple instances in tmux or screen sessions. For developers who spend most of their day in a terminal, Croft reduces context‑switching friction while still offering modern conveniences such as LSP diagnostics and inline previews.
The project also highlights the growing maturity of Rust’s ecosystem for UI work: ratatui provides a declarative layout model, crossterm handles cross‑platform input, and portable‑pty abstracts PTY creation. As more crates converge on stable APIs, we can expect an expanding class of terminal‑native applications that rival their GUI counterparts.
Counter‑Perspectives
- Platform limitation – Croft currently supports only macOS and Linux because it depends on POSIX
forkpty. Windows users must wait for a future implementation or rely on WSL. - Learning curve – Users accustomed to VS Code’s mouse‑heavy workflow may find the keyboard‑first paradigm initially daunting, especially when configuring custom keymaps for iTerm2.
- Feature parity – While Croft covers many core IDE functions, extensions, marketplace integration, and advanced debugging UI are still on the roadmap. Power users who rely on a rich extension ecosystem might not yet consider Croft a full replacement.
Conclusion
Croft is a compelling proof‑of‑concept that the terminal can host a sophisticated, VS Code‑style development environment without sacrificing performance. Its careful engineering—ranging from a high‑speed fuzzy finder to robust LSP support—shows how Rust can bridge the gap between low‑level terminal control and high‑level IDE ergonomics. As the project matures, it may become the go‑to tool for developers who value speed, composability, and a single‑binary deployment model.
For more details, explore the repository on Codeberg or install directly with cargo install --git https://codeberg.org/vitali87/croft.git. The README includes step‑by‑step setup instructions for iTerm2, font configuration, and optional PDF preview dependencies.

Comments
Please log in or register to join the discussion