Skip to content

Instantly share code, notes, and snippets.

@anonymouss
Last active December 5, 2018 16:56
Show Gist options
  • Save anonymouss/240893e34a20e69c665ec53771659f35 to your computer and use it in GitHub Desktop.
Save anonymouss/240893e34a20e69c665ec53771659f35 to your computer and use it in GitHub Desktop.
cat with syntax highlight
#!/bin/bash
# prerequisition: pygments, `sudo pip install pygments`
# usage: copy this file to /usr/bin or create symlink in /usr/bin links to this file.
# remember add `x` permission.
echo ""
function mycat() {
local style="monokai"
pygmentize -P style=$style -P tabsize=4 -f terminal256 -g "$1"
echo "" # add blank line
}
for file in $@; do
mycat "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment