less command uses a programmable filter with which you can colorize
In this article an alias to do the same for
cat is shown.
To colorize files, I use
pygmentize, which is part of the
At the time of writing, I’m using
pygments version 2.9.0.
This is the alias.
alias catp 'pygmentize -O style=solarized-dark \!*'
Let’s break it down.
The name of the alias is
catp, short for
pygmentize sends output to standard output, so it acts like
It uses the filename to guess which lexer to use.
My terminals use the
solarized-dark theme, so use the same style for
!* is a history substitution, where
! indicates the last event,
* all the parameters.
For comments, please send me an e-mail.
- Opening vim in a new terminal
- Setting the terminal title with urxvt and tcsh
- Defining command completions for tcsh