Home

Awesome

Package Control GitHub release Donate via PayPal

Python Improved

A better Python .tmLanguage syntax highlighting definition for Sublime Text and TextMate. It includes support for both Python 2 and Python 3, and unlike any other Python syntax definition now fully supports Unicode identifiers anywhere in your code! It also provides its own improved regex syntax definition for inline highlighting of raw string literals.

Inspired by:

as well as a number of my own changes to make things more consistent and understandable. For customized syntax highlighting taking advantage of all the new scopes, use PythonImproved with the Neon Color Scheme, or modify your own favorite color scheme with the scopes below.

Installation and Use

If you haven't already, install Package Control, then select Python Improved from the Package Control: Install Package option in the Command Palette. To use PythonImproved as your default Python syntax, open a .py file, then select View -> Syntax -> Open all with current extension as... -> PythonImproved.

While I haven't yet tried to install PythonImproved with TextMate, I can't think of a good reason as to why it wouldn't work. You could try putting it in the same directory as the standard Python.tmbundle package, in the Syntaxes subdirectory. Then, just pick PythonImproved from the syntax menu.

New/Changed Scopes

If you prefer to modify your own color scheme, here is a list of new/modified scopes, along with some examples. It's not perfectly complete, but it's a start.

def myfunc(self,            # gotta have self
           param1="value",  # values are cool
           param2=True,     # or False, whatever
           *args,           # I'm here for an argument
           **kwargs):       # you never know

Multi-line comments and function annotations

BUG FIXME TODO XXX line highlighting

Notes

Issues

If you have questions, concerns, or suggested improvements, I'd love to hear from you! Feel free to open an issue or send a pull request and I'll get back to you as soon as I can. You can also email me at mattdmo@mattdmo.com or find me on Twitter @MattDMo.

License

© 2013-2022 Matt Morrison mattdmo@mattdmo.com.

This is free software. It is licensed under the MIT License. Feel free to use this in your own work. However, if you modify and/or redistribute it, please attribute me in some way, and it would be great if you distribute your work under this or a similar license, but it's not required.. A shout-out or a beer would be appreciated.

Support

<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=R97MGGYES6GAJ&lc=US&item_name=Matthew%20D%2e%20Morrison&item_number=PythonImproved&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="Donate" alt="PayPal - The safer, easier way to pay online!"></a>