What is the problem?
Do you use your terminal a lot? Do you need to quickly glance at a file to check its contents? But maybe you want something more? Like syntax highlighting? Then read on… :)
Solutions
Using cat
The easiest thing is to use:
cat <filename>
It works great, it probably on every UNIX system there is. However, it doesn’t have syntax highlighting, so it’s just won’t cut it.
…or use Pygmentize
Now, Pygmentize is a syntax highlighter written in python. Here is a link to its official website.
Requirements
Installation
brew install python # Install python3
pip3 install Pygments # Install Pygments using python's package manager
Install theme
Clone the tomorrow theme repository.
If you followed the instructions above, then Pygments should be installed in: /usr/local/lib/python3.7/site-packages/pygments
*.
* Note that you may have a newer (or older) version of python.
git clone git@github.com:mozmorris/tomorrow-pygments.git <PATH_TO_GIT_REPOS>
cd <PATH_TO_GIT_REPOS>/tomorrow-pygments
cp styles/* /usr/local/lib/python3.7/site-packages/pygments/styles/
<PATH_TO_GIT_REPOS>
- the directory you want to clone the repository in.
Adding alias for easy use
In order to use the theme with all the proper colors you need to execute:
pygmentize -O style=tomorrownight -f console256 -g
Not easy to remember, so we need to add an alias for it. I am using Oh My ZSH, its config is located in: ~/.zshrc
. If you are using the default shell, then use the: ~/.bash_profile
.
Just add the following line:
alias ccat='pygmentize -O style=tomorrownight -f console256 -g'
ccat
stands for colorful cat, but you can use whatever you like. :)
Conclusion
Maybe not the most useful thing, but it’s way easier for me to glance through the contents of a file when I have syntax highlighting, otherwise it’s just a lot of STUFF on the screen.
Try it out and see if it works for you. ;)