bat
is a cat
replacement that adds syntax highlighting to file previews.
You can install bat
with brew install bat
Next, you simply call bat my_file.md
to print out the contents.
Instructor: [0:00] I'm going to cat.zshrc. As you can see, it prints the file in plain text with no highlighting. To get highlighting on a file in your terminal, you need to install bat. You can install it on Mac with brew install bat. I already have it installed so I'm not going to run the command.
[0:27] Now, instead of cat, I can run bat.zshrc. We will get this nice file view with line numbers and highlights. If I ls-a, you can see that I have this prettier.yml file. If I bat prettier.yml, you can see that syntax highlighting works on more than just SH files.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!