ST2 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.
ST3
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.
on_activated_async(view)
# =>
None
Called when a view gains input focus. Runs in a separate thread, and does not block the application.
on_clone_async(view)
# =>
None
Called when a view is cloned from an existing one. Runs in a separate thread, and does not block the application.
on_close(view)
# =>
None
Called when a view is closed (note, there may still be other views into the same buffer).
on_deactivated_async(view)
# =>
None
Called when a view loses input focus. Runs in a separate thread, and does not block the application.
on_hover(view, point, hover_zone)
# =>
None
Called when the user's mouse hovers over a view for a short period.
point is the closest point in the view to the mouse location. The mouse may not actually be located adjacent based on the value of hover_zone:
on_load_async(view)
# =>
None
Called when the file is finished loading. Runs in a separate thread, and does not block the application.
on_modified_async(view)
# =>
None
Called after changes have been made to a view. Runs in a separate thread, and does not block the application.
on_new_async(view)
# =>
None
Called when a new buffer is created. Runs in a separate thread, and does not block the application.
on_post_save_async(view)
# =>
None
Called after a view has been saved. Runs in a separate thread, and does not block the application.
on_post_text_command(view, command_name, args)
# =>
None
Called after a text command has been executed.
on_post_window_command(window, command_name, args)
# =>
None
Called after a window command has been executed.
on_pre_close(view)
# =>
None
Called when a view is about to be closed. The view will still be in the window at this point.
on_pre_save_async(view)
# =>
None
Called just before a view is saved. Runs in a separate thread, and does not block the application.
on_query_completions(view, prefix, locations)
# =>
list, tuple or None
Called whenever completions are to be presented to the user. The prefix is a unicode string of the text to complete.
locations is a list of points. Since this method is called for all completions in every view no matter the syntax, view.match_selector(point, relevant_scope)
should be called to determine if the point is relevant.
The return value must be one of the following formats:
None: no completions are provided
return None
A list of 2-element lists/tuples. The first element is a unicode string of the completion trigger, the second is the unicode replacement text.
return [["me1", "method1()"], ["me2", "method2()"]]
The trigger may contain a tab character (\t) followed by a hint to display in the right-hand side of the completion box.
return [
["me1\tmethod", "method1()"],
["me2\tmethod", "method2()"]
]
The replacement text may contain dollar-numeric fields such as a snippet does, e.g. $0, $1.
return [
["fn", "def ${1:name}($2) { $0 }"],
["for", "for ($1; $2; $3) { $0 }"]
]
A 2-element tuple with the first element being the list format documented above, and the second element being bit flags from the following list:
return (
[
["me1", "method1()"],
["me2", "method2()"]
],
sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
)
on_query_context(view, key, operator, operand, match_all)
# =>
bool or None
Called when determining to trigger a key binding with the given context key. If the plugin knows how to respond to the context, it should return either True of False. If the context is unknown, it should return None.
operator is one of:
match_all should be used if the context relates to the selections: does every selection have to match (match_all = True), or is at least one matching enough (match_all = Fals)?
on_query_context(view, key, operator, operand, match_all)
# =>
bool or None
Called when determining to trigger a key binding with the given context key. If the plugin knows how to respond to the context, it should return either True of False. If the context is unknown, it should return None.
operator is one of:
match_all should be used if the context relates to the selections: does every selection have to match (match_all == True), or is at least one matching enough (match_all == False)?
on_selection_modified(view)
# =>
None
Called after the selection has been modified in a view.
on_selection_modified_async(view)
# =>
None
Called after the selection has been modified in a view. Runs in a separate thread, and does not block the application.
on_text_command(view, command_name, args)
# =>
(str, dict)
Called when a text command is issued. The listener may return a (command, arguments) tuple to rewrite the command, or None to run the command unmodified.
on_window_command(window, command_name, args)
# =>
(str, dict)
Called when a window command is issued. The listener may return a (command, arguments) tuple to rewrite the command, or None to run the command unmodified.
Generated from the official documentation on Sat Oct 29 20:16:38 EEST 2016 by Leonid Shevtsov.