A modern, Unicode-aware replacement for ls that shows git status alongside file listings.
- 🎨 Color-coded git status - See which files are modified, staged, untracked, or clean
- 🌍 Full Unicode support - Handles all scripts correctly (Norwegian, Greek, Cyrillic, CJK, Arabic, etc.)
- 🔄 NFD/NFC normalization - Works correctly on macOS with decomposed Unicode
- 😊 Emoji support - Even complex multi-codepoint emoji work perfectly
- ⚡ Fast - Written in Zig for maximum performance
- 🛡️ Safe - Memory-safe with comprehensive error handling
- 🎯 ls-compatible flags - Familiar interface with
lsconventions
./install.shThe script handles everything: dependency checks, building, and installation to the correct location.
brew tap mariusei/tap
brew install lgmake release # or: zig build -Doptimize=ReleaseFast
./zig-out/bin/lg # Test the binarySee install.sh for installation logic details.
# List current directory
lg
# List with all files (including hidden)
lg -a
# List with permissions (standard detail)
lg -l
# List with full details (octal mode, group)
lg -ll
# Sort by size
lg -s
# Sort by time
lg -T
# Reverse order
lg -r
# Group by file type
lg -t
# Calculate directory sizes (slow for large trees)
lg -d
# Show git branch
lg --branch
# Show legend
lg --legend
# Combine flags (like ls)
lg -lan # all files, alphabetical, standard detail
lg -sr # sort by size, reversed (largest last)[●]- Staged changes[○]- Unstaged changes[?]- Untracked files[!]- Ignored files[·]- Clean/tracked (green dot, no changes)
lg uses utf8proc for complete Unicode normalization, supporting:
- All normalization forms: NFD, NFC, NFKD, NFKC
- All scripts: Latin, Greek, Cyrillic, Arabic, Hebrew, CJK, Thai, etc.
- Combining characters: Properly handles diacritics (é, ø, ü, etc.)
- Emoji: Full support including complex sequences (👨👩👧👦, 🇳🇴)
- macOS NFD filenames: Correctly matches decomposed and composed forms
# All of these work correctly, even if macOS stores them differently:
lg Müller.txt
lg café.txt
lg 北京.txt
lg Москва.txt
lg test😊.txtlg/
├── src/
│ ├── main.zig # Entry point
│ ├── cli.zig # Argument parsing
│ ├── filesystem.zig # File listing with utf8proc
│ ├── git.zig # Git status integration
│ ├── display.zig # Terminal output formatting
│ └── types.zig # Shared data structures
├── build.zig # Zig build configuration
├── build.zig.zon # Dependency manifest
└── archive/ # Legacy C implementation (deprecated)
- Memory safety without garbage collection
- Compile-time guarantees prevent many bugs
- C interop for utf8proc integration
- Modern tooling (package manager, build system)
- Performance comparable to C
Considered alternatives:
- ❌ Manual implementation: Only covered ~50 Latin characters, brittle
- ❌ ICU: 10-30MB overhead, massive overkill
- ❌ ziglyph/zg: Not yet compatible with Zig 0.15
- ✅ utf8proc:
- 100% Unicode coverage
- ~400KB shared library
- Battle-tested (Julia, PostgreSQL, Apache Arrow)
- Simple C API
- MIT licensed
Benchmarked on a directory with 1000 files:
ls: ~5ms
lg: ~8ms (includes git status)
lg -d: ~250ms (calculating directory sizes)
The slight overhead compared to ls comes from:
- Git status querying (~2ms)
- UTF-8 normalization (~1ms)
- Enhanced formatting
zig build testzig build -Doptimize=Debugzig build -Doptimize=ReleaseFastThe original C implementation has been moved to archive/. It is no longer maintained. The Zig version is the canonical implementation going forward.
See archive/README.md for details on the C version.
MIT License - see source files for details.
Contributions welcome! Please ensure:
- Code follows Zig style guidelines
- Tests pass (
zig build test) - Unicode edge cases are handled
- Documentation is updated