Skip to content

Instantly share code, notes, and snippets.

@d3v-null
Forked from EdwardBetts/pprint_color.py
Last active December 7, 2017 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d3v-null/97a768bd609855a9d361a47f776eb4f6 to your computer and use it in GitHub Desktop.
Save d3v-null/97a768bd609855a9d361a47f776eb4f6 to your computer and use it in GitHub Desktop.
My "one-liner" macro for pformatting an object with colour. I'd suggest using a snippet manager which supports cursor insertion (like Dash) to avoid having to scroll backwards to replace the @cursor placeholder. I have this mapped to ;cpp
from pygments import highlight; from pygments.lexers import PythonLexer; from pygments.formatters import Terminal256Formatter; from pprint import pformat; print(highlight(pformat( @cursor ), PythonLexer(), Terminal256Formatter()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment