Sublime Text X 20101022 is available now, with support for Python plugins. With this comes several important commands that depended on Python, such as Ctrl+D, Ctrl+Backspace, swap lines, etc.
Existing plugins for Sublime Text will not work with X, as the API is different. A quick summary of the changes:
- Naming convention has changed to conform to PEP 8.
- Arguments are passed to commands by keyword.
- Functions that modify the state of the buffer (insert, erase, replace) take an ‘Edit’ object as an argument. This enables better support for controlling undo groups (and macros+repeat by association). TextCommands get an Edit object passed to their run function, other plugins may create one as needed by using view.begin_edit(). It’s important that references to Edit objects are not kept around: there should be no references left to any Edit object when a command finishes.
- Events (on_load() etc) are only delivered to classes that inherit from sublime_plugin.EventListener. Commands no longer receive these events.
Not all functions present in the Sublime Text API have made their way into Sublime Text X yet. Notably, the Window object only responds to run_command() at the moment. There’s also no console yet. I wouldn’t recommend putting too much effort into playing around with plugins until these are implemented.