OK, so technically this is a language definition and not a plugin, but I figured Iâd post it here anyways. [size=150]Python Improved[/size] has (finally) been released on Package Control for all the world to use. Basically, I started out with the default Python.tmLanguage files from ST2 and TextMate, and ironed out a few minor (if I recall) differences between them, and started making some improvements, like having any *Exception or *Error highlighted, instead of just the predefined ones, and clarifying the difference between a âbuiltin functionâ (like open() or isinstance()) and a âbuiltin typeâ (like âasciiâ or âbytearrayâ), even though many of them are also functions. Iâm also a huge fan of @wuubâs SublimeREPL and its IPython integration, so I added scopes to highlight the âIn #]/Out #]â line markers.
At some point I discovered @facelessuserâs Better Python and adapted many ideas from there. I then started playing with Django and installed Djaneiro, but wasnât completely happy with it, so I cannabalized the parts I liked most and added them to what I was now calling âPythonImprovedâ. The project kind of languished for a while, but the success Iâve had with my Neon Color Scheme, which contains syntax highlighting for all of the new scopes in PythonImproved, I decided to clean it up, put together a README, and submit it to Package Control, and here we are.
Issues:
None that Iâm really aware of, having been using it and tweaking it for most of the past year, but there is one thing Iâd like to ask for help on: I havenât put an extensive amount of work into it, but Iâd love to support Python 3âs function annotations, even just the straightforward â:â and â->â operators, perhaps with a specialized scope for the word that comes after:
def greet(name: str, age: int) -> str:
print('Hello {0}, you are {1} years old'.format(name, age))
# instead of the standard
def greet(name, age):
print(...)
So, if youâre an expert regexer and want to contribute, head over to GitHub and open a pull request. Otherwise, if you have any other questions, concerns, implementation problems, whatever, feel free to open an issue and Iâll get back to you as soon as I can.
This will go into the README soon, but if you love Python Improved so much you want to make it your default Python language definition, do the following (in ST2):
- Copy âPackages/Python Improved/PythonImproved.tmLanguageâ to some other location in your filesystem, not under the Sublime Text hierarchy.
- Open PythonImproved.tmLanguage in ST2.
- Change the contents of the key on line 44 to âPythonâ
- Save the file as âPython.tmLanguageâ
- Quit ST2.
- From your OS/command line, rename âPackages/Python/Python.tmLanguageâ to âPython.tmLanguage.backupâ or something similar, just in case.
- Delete âPackages/Python/Python.tmLanguage.cacheâ
- Copy the newly edited and renamed Python.tmLanguage from its other location to âPackages/Pythonâ
- Restart ST2.
- ???
- Profit!
(sorry, couldnât help myself)
So, I hope you enjoy it, and if you have any questions just let me know!
MattDMo