Skip to content

Instantly share code, notes, and snippets.

@carlsmith
Last active April 5, 2017 02:04
Show Gist options
  • Save carlsmith/010b7f58a51cf9cf06c9b4b1a0df54f2 to your computer and use it in GitHub Desktop.
Save carlsmith/010b7f58a51cf9cf06c9b4b1a0df54f2 to your computer and use it in GitHub Desktop.
IPython line magic that adds highlighting to `less` using `pygmentize` - basically a coloured `cat` that scrolls well.
@line_magic
def nyan(path): os.system("pygmentize -g {0} | less -R".format(path))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment