alexjgriffith / nyancat

Nyancat a really slow cat but with syntax highlighting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nyancat

Nyancat

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.

Setup

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

Examples

Normal Usage

To print the whole file with your systems default colours just use nyancat [file]

nyancat sample.c

nyancat sample.c

Printing with Line Numbers

Sometimes you want line numbers, you can pass in the arg -l and you'll get them!

nyancat -l sample.c

nyancat sample.c

Setting the Style

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 sample.c

Check Out the Style

nyancat -x -s=nord

nyancat sample.c

See How the pygmentize Calls are Generated

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

nyancat sample.c

About

Nyancat a really slow cat but with syntax highlighting


Languages

Language:Shell 98.6%Language:C 1.4%