gdiff
Glam Diff - A beautiful terminal diff viewer built with Charm libraries.

Features
- π¨ Beautiful TUI - Built with Bubble Tea and Lip Gloss
- π Smart Diff - Structural diffing with intelligent alignment
- π― Dual View Modes - Toggle between unified and side-by-side views
- β¨οΈ Vim-style Navigation - Intuitive keyboard shortcuts
- π¨ Toggleable Syntax Highlighting - Color-coded additions (green), deletions (red), and modifications (orange/yellow)
- βοΈ Configurable - Extensible architecture for customization
- π Inline Statistics Panel - Quick access to diff statistics without leaving the main view
- π‘ Contextual Help Panel - In-place help display for easy reference
Installation
From Source
git clone https://github.com/cj3636/gdiff.git
cd gdiff
make build
Or manually:
go build -o gdiff .
Using Go Install
go install github.com/cj3636/gdiff@latest
Using Make Targets
make help # Show all available commands
make build # Build the application
make install # Install to $GOPATH/bin
make clean # Remove build artifacts
make fmt # Format code
make test # Run tests
Usage
Basic Usage
gdiff file1.txt file2.txt
Command-Line Options
gdiff [options] <file1> <file2>
Options:
-h, --help Show help information
-v, --version Show version information
-n, --no-line-numbers Hide line numbers
-t, --tab-size int Set tab size (default 4)
Examples
# Compare two text files
gdiff old.txt new.txt
# Compare without line numbers
gdiff -n config1.json config2.json
# Compare with custom tab size
gdiff -t 2 code1.go code2.go
Keyboard Shortcuts
| Key |
Action |
j / β |
Scroll down one line |
k / β |
Scroll up one line |
d |
Scroll half page down |
u |
Scroll half page up |
g |
Go to top |
G |
Go to bottom |
v |
Toggle side-by-side view |
c |
Toggle syntax highlighting |
s |
Toggle statistics panel |
? / h |
Toggle help panel |
q / ^C |
Quit |
Architecture
The project is organized for extensibility and maintainability:
gdiff/
βββ main.go # Entry point with CLI handling
βββ internal/
β βββ config/ # Configuration system
β βββ diff/ # Diff engine with multiple algorithms
β βββ tui/ # Terminal UI components
βββ go.mod
βββ README.md
Key Components
- Diff Engine (
internal/diff): Handles file comparison using intelligent algorithms
- TUI Layer (
internal/tui): Bubble Tea model for interactive display
- Config System (
internal/config): Flexible configuration with themes
Comparison with Difftastic
gdiff is inspired by difftastic and aims to provide:
- β
Beautiful terminal UI with Charm libraries
- β
Easy-to-use interface with intuitive navigation
- β
Extensible architecture for future enhancements
- β
Side-by-side diff view
- β
Color-coded changes
- π§ Structural/syntax-aware diffing (planned)
- π§ Language detection (planned)
- π§ Git integration (planned)
Future Enhancements
This is the foundation for a full TUI for managing and viewing local git repositories. Planned features include:
- Syntax-aware structural diffing
- Language detection and specific highlighting
- Git repository integration
- Interactive staging/unstaging
- Multiple file comparison
- Custom theme configuration
- Plugin system for extensibility
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - See LICENSE file for details.
Acknowledgments