| Methods | Return Value | Description |
| setTimeout(callback, delay) | none | Calls the given callback after the given delay (in milliseconds). Callbacks with an equal delay will be run in the order they were added. It is safe to call setTimeout from multiple threads. |
| statusMessage(string) | none | Sets the message that appears in the status bar. |
| errorMessage(string) | none | Displays an error dialog to the user. |
| messageBox(string) | none | Displays a message box to the user. |
| questionBox(string) | bool | Displays a yes / no message box to the user, return True iff they selected yes. |
| options() | Options | Returns a reference to the application options. |
| runCommand(string) | none | Runs the named ApplicationCommand. |
| runCommand(string, args) | none | Runs the named ApplicationCommand with the given arguments. |
| packagesPath() | String | Returns the base path to the packages. |
| installedPackagesPath() | String | Returns the path where all the user's *.sublime-package files are. |
| getClipboard() | String | Returns the contents of the clipboard. |
| setClipboard(string) | none | Sets the contents of the clipboard. |
Represents a view into a text buffer. Note that multiple views may refer to the same buffer, but they have their own unique selection and geometry.
| Methods | Return Value | Description |
| fileName() | String | The full name file the file associated with the buffer, or None if it doesn't exist on disk. |
| options() | Options | Returns a reference to the file type options for the view. |
| window() | Window | Returns a reference to the window containing the view. |
| runCommand(string) | none | Runs the named ViewCommand. |
| runCommand(string, args) | none | Runs the named ViewCommand with the given arguments. |
| size() | int | Returns the number of character in the file. |
| substr(region) | String | Returns the contents of the region as a string. |
| substr(point) | String | Returns the character to the right of the point. |
| insert(point, string) | none | Inserts the given string in the buffer at the specified point. |
| erase(region) | none | Erases the contents of the region from the buffer. |
| replace(region, string) | none | Replaces the contents of the region with the given string. |
| sel() | RegionSet | Returns a reference to the selection. |
| line(point) | Region | Returns the line that contains the point. |
| line(region) | Region | Returns a modified copy of region such that it starts at the beginning of a line, and ends at the end of a line. Note that it may span several lines. |
| fullLine(point) | Region | As line(), but the region includes the trailing newline character, if any. |
| fullLine(region) | Region | As line(), but the region includes the trailing newline character, if any. |
| lines(region) | [Region] | Returns a list of lines (in sorted order) intersecting the region. |
| splitByLines(region) | [Region] | Splits the region up such that each region returned exists on exactly one line. |
| rowcol(point) | (int, int) | Calculates the 0 based line and column numbers of the point. |
| textPoint(row, col) | int | Calculates the character offset of the given, 0 based, row and column. Note that 'col' is interpreted as the number of characters to advance past the beginning of the row. |
| extractScope(point) | Region | Returns the extents of the syntax name assigned to the character at the given point. |
| syntaxName(point) | String | Returns the syntax name assigned to the character at the given point. |
| matchSelector(point, selector) | bool | Returns True iff the selector matches the syntax name assigned to the character at the given point. |
Maintains a set of Regions, ensuring that none overlap, and that they are kept in sorted order.
Represents an area of the buffer. Empty regions, where a == b are valid.
| Methods | Return Value | Description |
| begin() | int | Returns the minimum of a and b. |
| end() | int | Returns the maximum of a and b. |
| size() | int | Returns the number of characters spanned by the region. Always >= 0. |
| empty() | bool | Returns true iff begin() == end(). |
| cover(region) | Region | Returns a Region spanning both this and the given regions. |
| intersection(region) | Region | Returns the set intersection of the two regions. |
| intersects(region) | bool | Returns True iff this == region or both include one or more positions in common. |
| contains(region) | bool | Returns True iff the given region is a subset. |
| contains(point) | bool | Returns True iff begin() <= point <= end(). |
Note that many of these events are triggered by the buffer underlying the view, and thus the method is only called once, with the first view as the parameter.
| Methods | Return Value | Description |
| onNew(view) | none | Called when a new buffer is created. |
| onClone(view) | none | Called when a view is cloned from an existing one. |
| onLoad(view) | none | Called when the file is finished loading. |
| onClose(view) | none | Called when a view is closed (note, there may still be other views into the same buffer). |
| onPreSave(view) | none | Called just before a view is saved. |
| onPostSave(view) | none | Called after a view has been saved. |
| onModified(view) | none | Called after changes have been made to a view. |
| onActivated(view) | none | Called when a view gains input focus. |