Z-Edit
Overview
Z-Edit is an intelligent file editor launcher designed for developers who work with multiple file types and switching between editors efficiently is crucial.
Links
- Project Site: pilakkat.mywire.org/z-edit/
- GitHub: pilakkat1964/z-edit
- Issues: Report bugs or request features
- Latest Release: GitHub Releases
Problem
Developers often work with diverse file types - source code, configuration files, documentation, media assets - each requiring a different tool. Manual editor selection is tedious and error-prone. Z-Edit solves this by automatically choosing the right editor based on:
- MIME type (content-based via libmagic)
- File extension (fallback method)
- Layered configuration (system, user, project-level)
Solution
A single-file Python application that:
- Detects file types with zero hard dependencies
- Supports optional libmagic for accurate MIME detection
- Uses layered TOML configuration for flexibility
- Integrates seamlessly with Unix pipelines
- Provides interactive editor selection when ambiguous
Key Features
✅ Zero Hard Dependencies - Works with Python 3.11+ stdlib alone
✅ Fast Startup - Minimal overhead for rapid editor launch
✅ Layered Configuration - System → User → Project precedence
✅ MIME Type Detection - Content-based or extension-based
✅ Interactive Modes - Choose, preview, or dump editors
✅ $EDITOR Integration - Respects environment variables
Architecture
Configuration Subsystem
- Loads and merges TOML configs from 5 priority levels
- Deep-merge algorithm for flexible overrides
- Validates configuration schema
MIME Detection
- Tries libmagic (python-magic) first when available
- Falls back to extension-based guessing
- Extensible for custom detection methods
Editor Resolution
- Priority-based algorithm: MIME → Extension → Wildcard → $EDITOR
- Handles $VISUAL and $EDITOR variables
- Batch processing for multiple files
Use Cases
Web Developer
1
2
3
4
zedit main.py # vim (text/x-python)
zedit styles.css # neovim (text/css)
zedit report.pdf # evince (application/pdf)
zedit image.png # gimp (image/png)
DevOps Engineer
Create .zedit.toml in project root for team consistency:
1
2
3
4
5
6
[defaults]
prefer_mime = true
[mime_types]
"text/x-yaml" = "vim"
"text/plain" = "nano"
Technical Stack
- Language: Python 3.11+
- Build System: CMake, uv
- CI/CD: GitHub Actions
- Distribution: PyPI, system packages (DEB, RPM)
- Documentation: GitHub Pages, Jekyll
Statistics
- Lines of Code: 1,725 (single file)
- Test Coverage: Comprehensive smoke tests
- Dependencies: Optional (python-magic)
- Python Version Support: 3.11, 3.12, 3.13
Getting Started
1
2
3
4
5
6
7
8
# Quick setup
./setup-env.sh --force
# Use zedit
zedit myfile.py # Auto-select editor
ze document.pdf # Use 'ze' alias
zedit --list # Show all mappings
zedit --init-config # Create user config
Documentation
- User Guide - Installation and usage
- Design Document - Architecture deep-dive
- Build Guide - Compilation and packaging
- Development Guide - Contributing workflow
Status: ✅ Production Ready (v0.6.5)
License: MIT
Last Updated: April 2026