{"id":50614287,"url":"https://github.com/faratech/nano-rs","last_synced_at":"2026-06-06T07:00:53.122Z","repository":{"id":362697745,"uuid":"1260350415","full_name":"faratech/nano-rs","owner":"faratech","description":"⚠️ Independent Rust port of GNU nano (NOT official) - Educational transliteration of the nano text editor","archived":false,"fork":false,"pushed_at":"2026-06-05T13:14:39.000Z","size":812065,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"rust-port","last_synced_at":"2026-06-05T15:10:22.240Z","etag":null,"topics":["educational","gnu-nano","rust","text-editor"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faratech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-05T11:59:21.000Z","updated_at":"2026-06-05T13:14:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/faratech/nano-rs","commit_stats":null,"previous_names":["faratech/nano-rs"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/faratech/nano-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faratech%2Fnano-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faratech%2Fnano-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faratech%2Fnano-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faratech%2Fnano-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faratech","download_url":"https://codeload.github.com/faratech/nano-rs/tar.gz/refs/heads/rust-port","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faratech%2Fnano-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33972398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["educational","gnu-nano","rust","text-editor"],"created_at":"2026-06-06T07:00:52.567Z","updated_at":"2026-06-06T07:00:53.112Z","avatar_url":"https://github.com/faratech.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nano-rs: Rust Port of GNU nano\n\n⚠️ **Disclaimer**: This is an **independent, unofficial Rust transliteration** of the [GNU nano](https://www.nano-editor.org/) text editor. This project is **NOT affiliated with or endorsed by the official GNU nano project**. For the official nano, visit https://www.nano-editor.org/.\n\n## Overview\n\nThis is a **pure Rust implementation** of the nano text editor — a 1:1 educational port from the C codebase that preserves the original architecture and behavior while leveraging Rust's type safety and memory guarantees. \n\nThis repository contains **only the Rust implementation**. The original C code is not included; for reference, see the [official GNU nano repository](https://git.savannah.gnu.org/git/nano.git).\n\n### Why Rust?\n\n- **Memory safety**: Eliminates entire classes of bugs (buffer overflows, use-after-free)\n- **Fearless concurrency**: Rust's ownership system prevents data races at compile time\n- **Same performance**: Direct translation maintains nano's efficient design\n- **Cross-platform**: Single codebase compiles on Linux, macOS, Windows, and more\n\n## ⚠️ Bug Reports\n\n**This is an independent project.** If you encounter bugs:\n- ✅ **Report to nano-rs**: https://github.com/faratech/nano-rs/issues\n- ❌ **DO NOT report to official nano**: Use only for bugs in the official C nano\n\nBugs in nano-rs should not be reported to the official GNU nano project at https://www.nano-editor.org/ - they maintain the official C implementation separately.\n\n## Supported Platforms\n\n- ✅ Linux (aarch64, x86_64)\n- ✅ Windows MSVC (x86_64, aarch64)\n- ✅ macOS (via standard Rust toolchain)\n\n## Building\n\n### Prerequisites\n\n- Rust 1.70+ (includes Cargo)\n- For MSVC targets on non-Windows: xwin and lld-link\n\n### Quick Start\n\n```bash\ncargo build --release\n```\n\nThe binary will be at `target/release/nano` (or `target/release/nano.exe` on Windows).\n\n### Build Options\n\n#### Feature Flags\n\nControl which nano features to compile:\n\n```bash\n# Minimal build (tiny mode)\ncargo build --no-default-features --features=tiny\n\n# Full-featured build\ncargo build --all-features\n\n# Custom features\ncargo build --features=color,nanorc,utf8\n```\n\nAvailable features:\n- `tiny` - Minimal feature set\n- `color` - Syntax highlighting\n- `nanorc` - Configuration file support\n- `utf8` - Unicode support\n- `browser` - File browser\n- `help` - Help system\n- `histories` - Search/replace history\n- `justify` - Paragraph justification\n- `linter` - Lint integration\n- `formatter` - Code formatting\n- `speller` - Spell checker\n- `mouse` - Mouse support\n- And more...\n\n#### Cross-Compilation to Windows\n\n```bash\n# Download Windows SDK (one-time setup)\necho \"yes\" | xwin splat --output /opt/xwin\n\n# Build for Windows x86_64\ncargo build --target x86_64-pc-windows-msvc --release\n\n# Build for Windows ARM64\ncargo build --target aarch64-pc-windows-msvc --release\n```\n\n### Cargo Configuration\n\nA `.cargo/config.toml` is included for MSVC cross-compilation setup.\n\n## Architecture\n\n### Module Mapping\n\nThe Rust code mirrors the C source structure:\n\n| C File | Rust Module | Purpose |\n|--------|------------|---------|\n| `definitions.h` | `definitions.rs` | Type definitions, enums, constants |\n| `global.c` | `global.rs` | Global state, keybindings |\n| `nano.c` | `nano.rs` | Main loop, event dispatch |\n| `winio.c` | `winio.rs` | Terminal I/O (crossterm) |\n| `move.c` | `move_.rs` | Cursor movement |\n| `files.c` | `files.rs` | File I/O, locking |\n| `search.c` | `search.rs` | Search/replace |\n| `text.c` | `text.rs` | Text manipulation |\n| `cut.c` | `cut.rs` | Cut/copy/paste |\n| ... | ... | ... |\n\n### Key Design Decisions\n\n**Global State**: Uses `NanoCell(UnsafeCell\u003cAppState\u003e)` in `global.rs` for re-entrant access matching C semantics, avoiding the limitations of `RefCell`.\n\n**Linked Lists**: `type LinePtr = Rc\u003cRefCell\u003cLineNode\u003e\u003e` with `Weak` back-pointers for the document tree.\n\n**Flag Macros**: `ISSET!(FLAG)`, `SET!(FLAG)`, `UNSET!(FLAG)`, `TOGGLE!(FLAG)` macros defined in `global.rs`.\n\n**Terminal Handling**: `crossterm` crate replaces ncurses for cross-platform terminal control.\n\n**Localization**: `tr!(\"string\")` macro for gettext-style i18n.\n\n## Development\n\n### Running Tests\n\n```bash\ncargo test\n```\n\n### Type Checking Only\n\n```bash\ncargo check\n```\n\n### Linting\n\n```bash\ncargo clippy\n```\n\n### Formatting\n\n```bash\ncargo fmt\n```\n\n## Differences from C Nano\n\n### Intentional Changes\n\n1. **Platform-specific code is properly gated**: Unix-only features (signals, termios) are guarded with `#[cfg(unix)]`\n2. **Modern file APIs**: Uses Rust's `std::fs` instead of libc where possible\n3. **Structured error handling**: Results and Options instead of sentinel values\n4. **No global mutable state**: State accessed through `with_state()`/`with_state_mut()` helpers\n\n### Preserved Behavior\n\n- Command syntax and keybindings\n- File handling and locking\n- Search/replace regex patterns\n- Undo/redo system\n- Syntax highlighting rules\n- Configuration file format\n\n## License\n\nGNU General Public License v3 or later (GPL-3.0+). This Rust port maintains the same license as the original GNU nano project. See `COPYING` and `COPYING.DOC`.\n\n## Contributing\n\nContributions to this Rust port are welcome! Please ensure:\n\n- Code follows Rust idioms and conventions\n- Changes preserve nano's functionality and behavior\n- All tests pass: `cargo test`\n- Code is formatted: `cargo fmt`\n- No clippy warnings: `cargo clippy`\n\n**Note**: This is an independent community project. For contributions to the official GNU nano, visit https://www.nano-editor.org/\n\n## See Also\n\n- **[GNU nano (Official)](https://www.nano-editor.org/)** - The original and official C implementation\n- **[nano Repository](https://git.savannah.gnu.org/git/nano.git)** - Official development repository (Savannah)\n\n## Status\n\n**Educational Project**: This Rust port is feature-complete and demonstrates a 1:1 translation of nano's architecture. It is suitable for learning and study purposes, but should not be considered an official GNU nano release.\n\n**Platform Support**:\n- Linux: ✅ Fully supported\n- Windows: ✅ Fully supported (MSVC only)\n- macOS: ✅ Fully supported\n\n**Known Issues**:\n- On Windows, history file initialization may require manual directory creation (`%USERPROFILE%\\.nano\\`)\n\n## Authors \u0026 Attribution\n\n**Rust Port (Independent Project)**: Mike Fara  \n**Original GNU nano**: Chris Allegretta and the official nano contributors\n\nThis Rust port is not created, maintained, or endorsed by the GNU nano project or its maintainers. It is an independent educational project that transliterates the original C code into Rust for learning and demonstration purposes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaratech%2Fnano-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaratech%2Fnano-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaratech%2Fnano-rs/lists"}