Documentation
Welcome to the official documentation for Klein — a professional terminal-hosted IDE (TIDE) designed to combine the power of modern editors with the speed of terminal-native tools.
Overview
Klein is a lightweight, terminal-based text editor built in Rust. It provides an IDE-like interface using ratatui for the user interface and portable-pty for terminal integration, giving developers a keyboard-centric coding environment directly in the command line.
Whether you're editing multiple files, browsing a project directory, or compiling code from the embedded shell, Klein brings essential workflow tools into one efficient console application.
Key Features
Klein doesn't compromise on functionality or looks. Here is what you get out of the box:
🧠 Tree-sitter Parsing
Structural syntax trees for 12+ languages with accurate highlighting and editing support.
🔌 LSP Intelligence
Auto-completion, diagnostics, hover docs, rename, and WorkspaceEdit via Language Server Protocol.
📝 Rope-Based Editor
Modern text buffer with undo/redo, structural editing, and efficient range replacement.
🔍 Project-Wide Search
Fuzzy file finder and project grep with interactive picker UI and live preview.
🗂️ Multi-Tab Editing
Seamlessly open and manage multiple files using intuitive tab navigation.
💻 Integrated Terminal
A fully-featured embedded terminal to execute scripts, manage Git, and run build commands.
Installation
Via mise (Recommended)
If you have mise installed, a single command downloads and activates the latest pre-built binary:
mise use -g github:Adarsh-codesOP/Klein
mise auto-detects your OS and architecture. Run mise install github:Adarsh-codesOP/Klein@latest to refresh to a newer release.
Automatic Setup Script
A pair of installer scripts configure your workspace, download the binary, and set your preferred shell.
Windows (PowerShell):irm https://klein.adarshas.me/install.ps1 | iex
curl -sSL https://klein.adarshas.me/install.sh | bash
Via Cargo (crates.io)
Install Klein directly from crates.io using Cargo:
cargo install klein-ide
The crate is published as klein-ide, but the binary executable is simply klein.
Manual Build
Clone the repository and build from source using Cargo:
git clone https://github.com/adarsh-codesOP/Klein.git
cd Klein
cargo install --path .
CLI Usage
Klein supports standard command-line options for quick control:
# Show help information
klein --help
# Show version information
klein --version
# Start the editor in current directory
klein
Tree-sitter Integration
Klein uses Tree-sitter for full structural parsing, replacing traditional regex-based approaches. This enables accurate syntax highlighting, structural editing, and lays the foundation for advanced code intelligence.
Supported Languages
| Language | Status |
|---|---|
| Rust | ✅ Full support |
| Python | ✅ Full support |
| JavaScript | ✅ Full support |
| TypeScript | ✅ Full support |
| C | ✅ Full support |
| C++ | ✅ Full support |
| Go | ✅ Full support |
| Java | ✅ Full support |
| JSON | ✅ Full support |
| TOML | ✅ Full support |
| HTML / CSS | ✅ Full support |
| YAML | ✅ Full support |
| Markdown | ✅ Full support |
What Tree-sitter Enables
With Tree-sitter, Klein can understand the structure of your code, not just its text:
• Accurate syntax highlighting — Colors reflect actual syntax nodes, not regex heuristics
• Structural editing — Select, navigate, and manipulate code by syntax tree nodes
• Real-time updates — The syntax tree incrementally updates as you type
Language Server Protocol
Klein features a robust, actor-based LSP subsystem that brings full IDE intelligence to the terminal. Connect any LSP-compatible language server for rich editing support.
LSP Capabilities
| Feature | Description |
|---|---|
| Auto-completion | Context-aware completions with improved trigger handling |
| Diagnostics | Errors and warnings shown in the editor gutter and status bar |
| Hover Documentation | View inline documentation for symbols under cursor |
| Rename | Project-wide symbol renaming via the LSP |
| WorkspaceEdit | Apply multi-file edits from the language server |
| Document Sync | Reliable open/close/change notifications with dedup |
Klein will auto-detect and connect to language servers that are installed on your system. Use the install script to set up language servers for your preferred languages.
Search
Klein provides powerful project-wide search capabilities to help you find anything across your codebase.
File Search
Use Ctrl + P to open the fuzzy file finder. Start typing a filename and Klein will instantly show matching results with an interactive picker UI.
Project Grep
Use Ctrl + Shift + F for project-wide text search. Results are displayed in an interactive preview panel where you can navigate directly to matches.
Both search modes support fuzzy matching for fast, forgiving queries. Results update in real-time as you type.
Keybindings
Klein is designed to be fully navigable via keyboard, keeping your hands on the home row.
Navigation & Focus
| Shortcut | Action |
|---|---|
| Ctrl + ← / → | Switch focus (Sidebar, Editor, Terminal) |
| Ctrl + R | Focus Explorer (Sidebar) |
| Ctrl + E | Focus Editor |
| Ctrl + T | Focus Terminal |
| Ctrl + B | Toggle Sidebar Visibility |
| Ctrl + ` | Toggle Terminal Visibility |
Editor & Tabs
| Shortcut | Action |
|---|---|
| Ctrl + Shift + Z | Next Tab |
| Ctrl + Shift + X | Close Current Tab |
| Ctrl + S | Save Current File |
| Ctrl + C | Copy Selection |
| Ctrl + V | Paste from Clipboard |
| Ctrl + Q | Quit Application |
Press Ctrl + H inside Klein at any time to open the interactive help overlay.
Configuration
Make Klein truly yours. Core configurations, including default shell paths, UI colors, and text banners, can be modified in the source.
Navigate to src/config.rs to adjust the TIDE's environment:
// Example: Altering default focus colors in src/config.rs
pub mod colors {
use ratatui::style::Color;
pub const EXPLORER_FOCUS: Color = Color::Green;
pub const EDITOR_FOCUS: Color = Color::Yellow;
pub const TERMINAL_FOCUS: Color = Color::Cyan;
}
Any changes made to src/config.rs require a cargo run or cargo install to take effect.
Contributing
We welcome contributions of all shapes and sizes! Whether you are squashing a bug, adding a new feature, or simply fixing a typo, your help is greatly appreciated.
Please read our Contributing Guidelines to understand the workflow for submitting pull requests and reporting issues.