About
A drop-in pager that adds syntax highlighting, a grid and line numbers. It also integrates with the version-control diff view. Easier on the eye than a plain dump when you read code or configuration.
Install it
pkg install bat
Run this inside Termux. If the package is already present, pkg will say so and
do nothing.
Commands worth knowing
6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.
bat main.ts Print a source file with syntax highlighting, line numbers and a header. bat -p main.ts Show plain highlighted text, without line numbers or the header. bat -n main.ts Force line numbers on, even when output is piped. bat --line-range 20:40 main.ts Display only a slice of lines from the middle of a long file. bat -A main.ts Show non-printing characters such as tabs and trailing spaces. bat -l json payload.json Override the detected language, so highlighting uses the right rules. Worked example
Run bat --line-range 1:3 main.ts and this is what you should see.
$ bat --line-range 1:3 main.ts
─── main.ts ───
1 import { Tool } from './types';
2
3 export const filesTextTools: Tool[] = []; Developed by
David Peter .