Claude Code for Bat (Cat Alternative) (2026)
The Setup
You are using bat as a replacement for cat, a Rust-based command-line tool that provides syntax highlighting, Git integration, line numbers, and paging for file output. bat auto-detects file types and applies appropriate syntax highlighting, making code review and file inspection faster. Claude Code can display file contents, but it uses plain cat without highlighting or context.
What Claude Code Gets Wrong By Default
-
Uses
catfor file display. Claude runscat file.tsfor plain text output. bat provides syntax highlighting, line numbers, and Git change markers —bat file.tsgives much more readable output. -
Pipes through separate tools for highlighting. Claude chains
cat file.ts | pygmentizeor uses other colorizers. bat handles syntax highlighting natively for 100+ languages — no additional tools or pipes needed. -
Adds
--numberflag for line numbers. Claude runscat -n file.tsfor numbered lines. bat shows line numbers by default with--style=numbersand includes Git change indicators alongside. -
Ignores bat’s integration capabilities. Claude uses bat as a standalone viewer only. bat can be used as
MANPAGER,GIT_PAGER, and integrated with fzf, ripgrep, and other tools for enhanced output.
The CLAUDE.md Configuration
# Bat File Viewer
## Tools
- Viewer: bat (cat alternative with syntax highlighting)
- Features: syntax highlighting, line numbers, Git integration
- Paging: built-in paging with less
- Themes: customizable color themes
## Bat Rules
- View: bat file.ts (with syntax highlighting)
- Plain: bat --plain file.ts (no decorations)
- Language: bat -l json file (force language)
- Line range: bat --line-range 10:20 file.ts
- Diff: bat --diff file1.ts file2.ts
- Pager: bat --paging=never for piping
- Theme: bat --theme="Catppuccin Mocha"
## Conventions
- Use bat for all file viewing commands
- bat --plain for piping to other commands
- Set BAT_THEME in shell config for consistent theme
- Use bat as MANPAGER: export MANPAGER="bat -l man -p"
- Integration: rg --json | bat for highlighted ripgrep output
- Use bat --line-range for viewing specific sections
- bat --show-all for whitespace characters
Workflow Example
You want to set up bat as the default file viewer with project-specific configuration. Prompt Claude Code:
“Configure bat as the default pager for Git and man pages. Set the Catppuccin Mocha theme, enable Git integration, and create shell aliases for common bat operations. Also show how to use bat with ripgrep for highlighted search results.”
Claude Code should add export BAT_THEME="Catppuccin Mocha" to shell config, set export MANPAGER="sh -c 'col -bx | bat -l man -p'" and git config --global core.pager 'bat --paging=always', create aliases like alias preview='bat --line-range :50', and show the rg pattern --json | bat integration.
Common Pitfalls
-
Paging interfering with piping. Claude pipes bat output to other commands but the pager intercepts. Use
bat --paging=neverorbat -pwhen piping to other commands — the pager is for interactive viewing, not piping. -
Theme not matching terminal colors. Claude sets a bat theme that clashes with the terminal theme. Use
bat --list-themes | batto preview themes in your terminal and pick one that matches your color scheme. -
Missing language detection for stdin. Claude pipes content to bat without specifying the language:
curl url | bat. Without a file extension, bat cannot detect the language. Usecurl url | bat -l jsonto specify the language explicitly.
Build yours → Create a custom CLAUDE.md with our Generator Tool.
Related Guides
Estimate tokens → Calculate your usage with our Token Estimator.
Try it: Estimate your monthly spend with our Cost Calculator.
- Claude Code for Ripgrep Workflow Guide
- Why Is Claude Code Terminal Based Not GUI
- Building a CLI Devtool with Claude Code Walkthrough
Frequently Asked Questions
Do I need a paid Anthropic plan to use this?
Claude Code works with any Anthropic API plan, including the free tier. However, the free tier has lower rate limits (requests per minute and tokens per minute) that may slow down multi-step workflows. For professional use, the Build or Scale plan provides higher limits and priority access during peak hours.
How does this affect token usage and cost?
The token cost depends on the size of your prompts and Claude’s responses. Typical development tasks consume 10K-50K tokens per interaction. Using a CLAUDE.md file and skills reduces exploration tokens by 50-80%, which directly lowers costs. Monitor your usage at console.anthropic.com/settings/billing.
Can I customize this for my specific project?
Yes. All Claude Code behavior can be customized through CLAUDE.md (project rules), .claude/settings.json (permissions), and .claude/skills/ (domain knowledge). The most impactful customization is adding your project’s specific patterns, conventions, and common commands to CLAUDE.md so Claude Code follows your standards from the start.
What happens when Claude Code makes a mistake?
Claude Code creates files and edits through standard filesystem operations, so all changes are visible in git diff. If a change is wrong, revert it with git checkout -- <file> for a single file or git stash for all changes. Claude Code does not make irreversible changes unless you explicitly allow destructive commands in settings.json.