🚀 leetrs (LeetCode TUI)
leetrs is a blazing-fast, Rust-powered CLI and engine designed to make solving LeetCode problems from the terminal a first-class developer experience.
Built specifically for developers who live in the terminal and rely on Neovim, leetrs strips away the distraction of the browser. It handles intelligent authentication, Markdown problem generation, native editor window splitting, and asynchronous code submission without ever leaving your workflow.
✨ Features
- Intelligent Authentication (
leetrs auth)- Automatically extracts
LEETCODE_SESSIONandcsrftokencookies from your active Chrome or Firefox sessions. - Secure, hidden manual fallback for containerized browser profiles.
- Automatically extracts
- Frictionless Problem Fetching (
leetrs pick)- Fetch problems using their URL slug (e.g.,
two-sum) or standard numerical ID (e.g.,1). - Automatically parses LeetCode's raw HTML into clean, readable Markdown.
- Generates idiomatic
snake_case.rsfiles containing the exact boilerplate required.
- Fetch problems using their URL slug (e.g.,
- Native Neovim Integration
- Instantly hijacks the terminal process to launch Neovim.
- Forces a clean vertical split (
vsplit) to place your problem description and code side-by-side, bypassing layout quirks from custom dashboards.
- Async Submission Engine (
leetrs submit)- Submit your local file directly to LeetCode's execution servers.
- Automatic ID resolution and CSRF token bypass.
- Color-coded terminal output for execution results, including Runtime/Memory statistics and detailed compiler error logs.
🛠️ Installation
Currently, leetrs is in beta and must be built from source.
Prerequisites
- Rust & Cargo
- Neovim (Accessible via the
nvimcommand in your PATH) - A valid LeetCode account
Build & Install
# 1. Clone the repository
# 2. Build the release binary
# 3. Move the binary to your PATH (e.g., /usr/local/bin or ~/.cargo/bin)