| Crates.io | mat-o-viewer |
| lib.rs | mat-o-viewer |
| version | 0.2.0 |
| created_at | 2025-12-04 09:22:39.615275+00 |
| updated_at | 2025-12-08 10:55:37.557496+00 |
| description | A modern terminal file viewer combining cat, less, and grep with syntax highlighting and markdown rendering |
| homepage | https://github.com/lelloman/mat |
| repository | https://github.com/lelloman/mat |
| max_upload_size | |
| id | 1966231 |
| size | 357,971 |
A modern terminal file viewer combining the best of cat, less, and grep with syntax highlighting and markdown rendering.
.md files with styled headings, code blocks, lists, and moren/Ntail -fcargo install mat
Or build from source:
git clone https://github.com/yourusername/mat
cd mat
cargo build --release
# View a file
mat file.txt
# View with line numbers
mat -n file.txt
# Pipe from stdin
cat file.txt | mat
echo "hello world" | mat
# Force syntax highlighting language
cat config | mat -l yaml
Filter to matching lines (like grep, but with context and paging):
# Show only matching lines
mat -g "pattern" file.txt
# With context lines
mat -g "error" -C 3 logfile.txt # 3 lines before and after
mat -g "error" -B 2 -A 5 log.txt # 2 before, 5 after
# Case insensitive
mat -g -i "warning" file.txt
# Fixed string (not regex)
mat -g -F "literal[string" file.txt
Highlight all matches of a pattern:
# Highlight pattern
mat -s "TODO" file.txt
# Then use n/N to jump between matches
# Auto-detected for .md files
mat README.md
# Force markdown rendering
mat -m somefile.txt
# Disable markdown rendering
mat -M README.md
Watch a file for changes (like tail -f):
mat -f /var/log/syslog
View specific line ranges:
mat -L 10:20 file.txt # Lines 10-20
mat -L 50: file.txt # Line 50 to end
mat -L :100 file.txt # First 100 lines
mat -L 42 file.txt # Just line 42
| Key | Action |
|---|---|
j / ↓ |
Scroll down one line |
k / ↑ |
Scroll up one line |
h / ← |
Scroll left |
l / → |
Scroll right |
d / Page Down |
Scroll down half page |
u / Page Up |
Scroll up half page |
g / Home |
Go to top |
G / End |
Go to bottom |
0 |
Scroll to line start |
$ |
Scroll to line end |
/ |
Open search prompt |
n |
Next search match |
N |
Previous search match |
f |
Toggle follow mode |
q / Esc |
Quit |
Usage: mat [OPTIONS] [FILE]
Arguments:
[FILE] File to view (use '-' for stdin)
Options:
-n, --line-numbers Show line numbers
-N, --no-highlight Disable syntax highlighting
-m, --markdown Force markdown rendering
-M, --no-markdown Disable markdown rendering
-f, --follow Follow mode (like tail -f)
-s, --search <PATTERN> Highlight pattern matches
-g, --grep <PATTERN> Filter to matching lines
-i, --ignore-case Case-insensitive search/grep
-F, --fixed-strings Treat pattern as literal string
-w, --word-regexp Match whole words only
-x, --line-regexp Match whole lines only
-A, --after <N> Lines to show after grep match
-B, --before <N> Lines to show before grep match
-C, --context <N> Lines to show before and after match
--wrap <MODE> Line wrap mode: none, wrap, truncate
-W, --max-width <N> Max line width for truncation
-l, --language <LANG> Force syntax highlighting language
-t, --theme <THEME> Color theme (light/dark)
-L, --lines <RANGE> Show line range (e.g., 10:20, :50, 100:)
-P, --no-pager Print directly without pager
--ansi Preserve ANSI escape codes in input
--force-binary Force display of binary files
-h, --help Print help
-V, --version Print version
-g): Filters the file to show only matching lines (with optional context). Matches highlighted in cyan.-s): Shows the entire file with matches highlighted in yellow. Use n/N to navigate.You can use both together:
mat -g "error" -s "critical" logfile.txt
mat uses syntect for syntax highlighting and supports 50+ languages including:
Rust, Python, JavaScript, TypeScript, Go, C, C++, Java, Ruby, PHP, Swift, Kotlin, Scala, Haskell, Lua, Perl, R, SQL, HTML, CSS, JSON, YAML, TOML, Markdown, Bash, and many more.
MIT