18 Aug 2009

Pretty Printing in Textmate

Here’s a quick and dirty snippet for pretty printing python dicts in Textmate. It’s very simple and won’t work in many cases due to the use of JSON, but it’ll work for dicts of primitives, as long as you aren’t using unicode/raw strings. Also, JSON doesn’t like single quotes, so I convert them blindly to double quotes, and this could cause massive issues. In short, your mileage may vary.