I.e, cat but with syntax highlighting.
This project is a wrapper around Pygments that presents a minimal subset of pygmentize's capabilities, specifically syntax highlighting files.
Clone the repo to wherever you clone your other gihub repos. I clone mine into ~/Github
cd ~/Github
clone https://github.com/alexjgriffith/nyancat
Now lets set the two bash files to be executable. You can vet them before this.
cd nyancat
chmod +x nyancat
# chmod +x nyancatlo # optional, right now only works for emacs
Finally you can put a symbolic link to it somewhere on your $PATH
. For local binaries I have ~/bin
on my $PATH
for local scripts like this.
ln -s ${PWD}/nyancat $HOME/bin
# ln -s ${PWD}/nyancatlo $HOME/bin
Now you'll be able to print your source files with syntax highlighting from the shell! Test it out on sample.c
in the resources folder of this repo :)
nyancat resources/sample.c
To print the whole file with your systems default colours just use nyancat [file]
nyancat sample.c
Sometimes you want line numbers, you can pass in the arg -l
and you'll get them!
nyancat -l sample.c
If you don't want to use your terminal's default colours you can pass in a style with the -s=
flag. To see the full list of styles available use nyancat -a
.
nyancat -s=nord sample.c
nyancat -x -s=nord
As I say above, Nyancat is just a wrapper around Pygments and its utility pygemntize. To see what is actually being called on your system pass in the -d
flag.
nyancat -d -x -s=nord