Plugin Basics

Sublime Text is extensible via Python. Extending is simply a matter of placing a python file under the Packages directory (For example C:\Documents and Settings\ username \Application Data\Sublime Text\Packages\User).

Each python file within the Packages directory is automatically scanned for Plugins, and automatically reloaded when changed.

To make a command that may be bound to a key, placed in a menu, etc, simply create a class extending sublimeplugin.TextCommand and override the run() method.

To make a plugin that receives notification of file load, save, etc, create a class extending sublimeplugin.Plugin, and implement one or more of the event methods (onLoad, onPostSave, etc). Note that TextCommand and friends themselves extend from Plugin, and may receive events.

When developing plugins, all syntax errors and print statements are directed to the console (accessible via Ctrl+~).

Next step: Take a look at some of the examples, or have a look over the API reference.