ST2 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.
ST3
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.
add_regions(key, [regions], scope, <icon>, <flags>)
# =>
None
Add a set of regions to the view. If a set of regions already exists with the given key, they will be overwritten. The scope is used to source a color to draw the regions in, it should be the name of a scope, such as "comment" or "string". If the scope is empty, the regions won't be drawn.
The optional icon name, if given, will draw the named icons in the gutter next to each region. The icon will be tinted using the color associated with the scope. Valid icon names are dot, circle, bookmark and cross.
The optional flags parameter is a bitwise combination of:
add_regions(key, [regions], <scope>, <icon>, <flags>)
# =>
None
Add a set of regions to the view. If a set of regions already exists with the given key, they will be overwritten. The scope is used to source a color to draw the regions in, it should be the name of a scope, such as "comment" or "string". If the scope is empty, the regions won't be drawn.
The optional icon name, if given, will draw the named icons in the gutter next to each region. The icon will be tinted using the color associated with the scope. Valid icon names are dot, circle, bookmark and cross. The icon name may also be a full package relative path, such as Packages/Theme - Default/dot.png.
The optional flags parameter is a bitwise combination of:
The underline styles are exclusive, either zero or one of them should be given. If using an underline, sublime.DRAW_NO_FILL and sublime.DRAW_NO_OUTLINE should generally be passed in.
begin_edit(<command>, <args>)
# =>
Edit
Creates an edit object, demarcating an undo group. A corresponding call to end_edit() is required.
buffer_id()
# =>
int
Returns a number that uniquely identifies the buffer underlying this view.
change_count()
# =>
int
Returns the current change count. Each time the buffer is modified, the change count is incremented. The change count can be used to determine if the buffer has changed since the last it was inspected.
classify(point)
# =>
int
Classifies point, returning a bitwise OR of zero or more of these flags:
command_history(index, <modifying_only>)
# =>
(String,Dict,int)
Returns the command name, command arguments, and repeat count for the given history entry, as stored in the undo / redo stack.
Index 0 corresponds to the most recent command, -1 the command before that, and so on. Positive values for index indicate to look in the redo stack for commands. If the undo / redo history doesn't extend far enough, then (None, None, 0) will be returned.
Setting modifying_only to True (the default is False) will only return entries that modified the buffer.
command_history(index, <modifying_only>)
# =>
(str, dict, int)
Returns the command name, command arguments, and repeat count for the given history entry, as stored in the undo / redo stack.
Index 0 corresponds to the most recent command, -1 the command before that, and so on. Positive values for index indicate to look in the redo stack for commands. If the undo / redo history doesn't extend far enough, then (None, None, 0) will be returned.
Setting modifying_only to True (the default is False) will only return entries that modified the buffer.
em_width()
# =>
real
Returns the typical character width used in the layout
em_width()
# =>
float
Returns the typical character width used in the layout
encoding()
# =>
String
Returns the encoding currently associated with the file
encoding()
# =>
str
Returns the encoding currently associated with the file
erase(edit, region)
# =>
None
Erases the contents of the region from the buffer.
erase(edit, region)
# =>
None
Erases the contents of the region from the buffer.
Expands point to the left and right, until each side lands on a location that matches classes. classes is a bitwise OR of the sublime.CLASS_XXX flags. separators may be passed in, to define what characters should be considered to separate words.
Expands region to the left and right, until each side lands on a location that matches classes. classes is a bitwise OR of the sublime.CLASS_XXX flags. separators may be passed in, to define what characters should be considered to separate words.
extract_scope(point)
# =>
Region
Returns the extent of the syntax name assigned to the character at the given point.
Returns the extent of the syntax scope name assigned to the character at the given point.
file_name()
# =>
String
The full name file the file associated with the buffer, or None if it doesn't exist on disk.
file_name()
# =>
str
The full name file the file associated with the buffer, or None if it doesn't exist on disk.
find(pattern, fromPosition, <flags>)
# =>
Region
Returns the first Region matching the regex pattern, starting from the given point, or None if it can't be found. The optional flags parameter may be sublime.LITERAL, sublime.IGNORECASE, or the two ORed together.
Returns the first region matching the regex pattern, starting from start_point, or None if it can't be found. The optional flags parameter may be sublime.LITERAL, sublime.IGNORECASE, or the two ORed together.
find_all(pattern, <flags>, <format>, <extractions>)
# =>
[Region]
Returns all (non-overlapping) regions matching the regex pattern. The optional flags parameter may be sublime.LITERAL, sublime.IGNORECASE, or the two ORed together. If a format string is given, then all matches will be formatted with the formatted string and placed into the extractions list.
Returns all (non-overlapping) regions matching the regex pattern. The optional flags parameter may be sublime.LITERAL, sublime.IGNORECASE, or the two ORed together. If a format string is given, then all matches will be formatted with the formatted string and placed into the extractions list.
Finds the next location after point that matches the given classes. If forward is False, searches backwards instead of forwards. classes is a bitwise OR of the sublime.CLASS_XXX flags. separators may be passed in, to define what characters should be considered to separate words.
find_by_selector(selector)
# =>
[Regions]
Finds all regions in the file matching the given selector, returning them as a list.
Finds all regions in the file matching the given selector, returning them as a list.
fold([regions])
# =>
bool
Folds the given regions, returning False if they were already folded
fold(region)
# =>
bool
Folds the given region, returning False if it was already folded
fold([regions])
# =>
bool
Folds the given regions, returning False if they were already folded
fold(region)
# =>
bool
Folds the given region, returning False if it was already folded
full_line(point)
# =>
Region
As line(), but the region includes the trailing newline character, if any.
full_line(region)
# =>
Region
As line(), but the region includes the trailing newline character, if any.
As line(), but the region includes the trailing newline character, if any.
As line(), but the region includes the trailing newline character, if any.
get_regions(key)
# =>
[regions]
Return the regions associated with the given key, if any
get_status(key)
# =>
String
Returns the previously assigned value associated with the key, if any.
get_status(key)
# =>
str
Returns the previously assigned value associated with the key, if any.
insert(edit, point, string)
# =>
int
Inserts the given string in the buffer at the specified point. Returns the number of characters inserted: this may be different if tabs are being translated into spaces in the current buffer.
insert(edit, point, string)
# =>
int
Inserts the given string in the buffer at the specified point. Returns the number of characters inserted: this may be different if tabs are being translated into spaces in the current buffer.
is_auto_complete_visible()
# =>
bool
Returns if the auto complete menu is currently visible.
is_dirty()
# =>
bool
Returns true if there are any unsaved modifications to the buffer.
is_dirty()
# =>
bool
Returns True if there are any unsaved modifications to the buffer.
is_loading()
# =>
bool
Returns true if the buffer is still loading from disk, and not ready for use.
is_loading()
# =>
bool
Returns True if the buffer is still loading from disk, and not ready for use.
is_primary()
# =>
bool
If the view is the primary view into a file. Will only be False if the user has opened multiple views into a file.
is_read_only()
# =>
bool
Returns true if the buffer may not be modified.
is_read_only()
# =>
bool
Returns True if the buffer may not be modified.
is_scratch()
# =>
bool
Returns true if the buffer is a scratch buffer. Scratch buffers never report as being dirty.
is_scratch()
# =>
bool
Returns True if the buffer is a scratch buffer. Scratch buffers never report as being dirty.
layout_to_text(vector)
# =>
point
Converts a layout position to a text position
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.
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.
line_endings()
# =>
String
Returns the line endings used by the current file.
line_endings()
# =>
str
Returns the line endings used by the current file.
line_height()
# =>
real
Returns the light height used in the layout
line_height()
# =>
float
Returns the light height used in the layout
lines(region)
# =>
[Region]
Returns a list of lines (in sorted order) intersecting the region.
match_selector(point, selector)
# =>
bool
Checks the selector against the scope at the given point, returning a bool if they match.
name()
# =>
String
The name assigned to the buffer, if any
name()
# =>
str
The name assigned to the buffer, if any
overwrite_status()
# =>
bool
Returns the overwrite status, which the user normally toggles via the insert key.
replace(edit, region, string)
# =>
None
Replaces the contents of the region with the given string.
replace(edit, region, string)
# =>
None
Replaces the contents of the region with the given string.
rowcol(point)
# =>
(int, int)
Calculates the 0 based line and column numbers of the point.
rowcol(point)
# =>
(int, int)
Calculates the 0-based line and column numbers of the point.
run_command(string, <args>)
# =>
None
Runs the named TextCommand with the (optional) given arguments.
run_command(string, <args>)
# =>
None
Runs the named TextCommand with the (optional) given args.
scope_name(point)
# =>
String
Returns the syntax name assigned to the character at the given point.
scope_name(point)
# =>
str
Returns the syntax scope name assigned to the character at the given point.
score_selector(point, selector)
# =>
Int
Matches the selector against the scope at the given location, returning a score. A score of 0 means no match, above 0 means a match. Different selectors may be compared against the same scope: a higher score means the selector is a better match for the scope.
score_selector(point, selector)
# =>
int
Matches the selector against the scope at the given point, returning a score. A score of 0 means no match, above 0 means a match. Different selectors may be compared against the same scope: a higher score means the selector is a better match for the scope.
set_encoding(encoding)
# =>
None
Applies a new encoding to the file. This encoding will be used the next time the file is saved.
set_line_endings(line_endings)
# =>
None
Sets the line endings that will be applied when next saving.
set_status(key, value)
# =>
None
Adds the status key to the view. The value will be displayed in the status bar, in a comma separated list of all status values, ordered by key. Setting the value to the empty string will clear the status.
set_status(key, value)
# =>
None
Adds the status key to the view. The value will be displayed in the status bar, in a comma separated list of all status values, ordered by key. Setting the value to the empty string will clear the status.
set_syntax_file(syntax_file)
# =>
None
Changes the syntax used by the view. syntax_file should be a name along the lines of Packages/Python/Python.tmLanguage. To retrieve the current syntax, use view.settings().get('syntax').
set_syntax_file(syntax_file)
# =>
None
Changes the syntax used by the view. syntax_file should be a name along the lines of Packages/Python/Python.tmLanguage. To retrieve the current syntax, use view.settings().get('syntax')
.
set_viewport_position(vector, <animate<)
# =>
None
Scrolls the viewport to the given layout position.
settings()
# =>
Settings
Returns a reference to the views settings object. Any changes to this settings object will be private to this view.
Returns a reference to the view's settings object. Any changes to this settings object will be private to this view.
show(point, <show_surrounds>)
# =>
None
Scroll the view to show the given point.
show(region, <show_surrounds>)
# =>
None
Scroll the view to show the given region.
show(region_set, <show_surrounds>)
# =>
None
Scroll the view to show the given region set.
show_at_center(point)
# =>
None
Scroll the view to center on the point.
show_at_center(region)
# =>
None
Scroll the view to center on the region.
show_popup(content, <flags>, <location>, <max_width>, <max_height>, <on_navigate>, <on_hide>)
# =>
None
Shows a popup displaying HTML content.
flags is a bitwise combination of the following:
The default location of -1 will display the popup at the cursor, otherwise a text point should be passed.
max_width and max_height set the maximum dimensions for the popup, after which scroll bars will be displayed.
on_navigate is a callback that should accept a string contents of the href attribute on the link the user clicked.
on_hide is called when the popup is hidden.
show_popup_menu(items, on_done, <flags>)
# =>
None
Shows a pop up menu at the caret, to select an item in a list. on_done will be called once, with the index of the selected item. If the pop up menu was cancelled, on_done will be called with an argument of -1.
items is a list of strings.
flags it currently unused.
split_by_newlines(region)
# =>
[Region]
Splits the region up such that each region returned exists on exactly one line.
Splits the region up such that each region returned exists on exactly one line.
substr(region)
# =>
String
Returns the contents of the region as a string.
substr(point)
# =>
String
Returns the character to the right of the point.
substr(region)
# =>
str
Returns the contents of the region as a string.
substr(point)
# =>
str
Returns the character to the right of the point.
text_point(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.
text_point(row, col)
# =>
int
Calculates the character offset of the given, 0-based, row and col. Note that col is interpreted as the number of characters to advance past the beginning of the row.
text_to_layout(point)
# =>
vector
Converts a text position to a layout position
unfold(region)
# =>
[regions]
Unfolds all text in the region, returning the unfolded regions
unfold([regions])
# =>
[regions]
Unfolds all text in the regions, returning the unfolded regions
update_popup(content)
# =>
None
Updates the contents of the currently visible popup.
viewport_extent()
# =>
vector
Returns the width and height of the viewport.
viewport_position()
# =>
Vector
Returns the offset of the viewport in layout coordinates.
visible_region()
# =>
Region
Returns the currently visible area of the view.
word(point)
# =>
Region
Returns the word that contains the point.
word(region)
# =>
Region
Returns a modified copy of region such that it starts at the beginning of a word, and ends at the end of a word. Note that it may span several words.
Returns a modified copy of region such that it starts at the beginning of a word, and ends at the end of a word. Note that it may span several words.
Generated from the official documentation on Sat Oct 29 20:16:54 EEST 2016 by Leonid Shevtsov.