sublime.Window

ST2



ST3



active_group ST2&3

ST2&3 active_group() # => int

Returns the index of the currently selected group.



active_panel ST3

ST3 active_panel() # => str or None

Returns the name of the currently open panel, or None if no panel is open. Will return built-in panel names (e.g. "console", "find", etc) in addition to output panels.



active_view ST2≠3

ST2 active_view() # => View

Returns the currently edited view.



ST3 active_view() # => View

Returns the currently edited view.



active_view_in_group ST2≠3

ST2 active_view_in_group(group) # => View

Returns the currently edited view in the given group.



ST3 active_view_in_group(group) # => View

Returns the currently edited view in the given group.



create_output_panel ST3

ST3 create_output_panel(name, <unlisted>) # => View

Returns the view associated with the named output panel, creating it if required. The output panel can be shown by running the show_panel window command, with the panel argument set to the name with an "output." prefix.

The optional unlisted parameter is a boolean to control if the output panel should be listed in the panel switcher.



destroy_output_panel ST3

ST3 destroy_output_panel(name) # => None

Destroys the named output panel, hiding it if currently open.



extract_variables ST3

ST3 extract_variables() # => dict

Returns a dictionary of strings populated with contextual keys:

packages, platform, file, file_path, file_name, file_base_name, file_extension, folder, project, project_path, project_name, project_base_name, project_extension. This dict is suitable for passing to sublime.expand_variables().



find_open_file ST3

ST3 find_open_file(file_name) # => View

Finds the named file in the list of open files, and returns the corresponding View, or None if no such file is open.



find_output_panel ST3

ST3 find_output_panel(name) # => View or None

Returns the view associated with the named output panel, or None if the output panel does not exist.



focus_group ST2≠3

ST2 focus_group(group) # => None

Makes the given group active.



ST3 focus_group(group) # => None

Makes the given group active.



focus_view ST2≠3

ST2 focus_view(view) # => None

Switches to the given view.



ST3 focus_view(view) # => None

Switches to the given view.



folders ST2≠3

ST2 folders() # => [String]

Returns a list of the currently open folders.



ST3 folders() # => [str]

Returns a list of the currently open folders.



get_output_panel ST2

ST2 get_output_panel(name) # => View

Returns the view associated with the named output panel, created it if required. The output panel can be shown by running the show_panel window command, with the panel argument set to the name with an "output." prefix.



get_tabs_visible ST3

ST3 get_tabs_visible() # => bool

Returns True if tabs will be shown for open files.



get_view_index ST2≠3

ST2 get_view_index(view) # => (group, index)

Returns the group, and index within the group of the view. Returns -1 if not found.



ST3 get_view_index(view) # => (int, int)

Returns the group, and index within the group of the view. Returns -1 if not found.



id ST2&3

ST2&3 id() # => int

Returns a number that uniquely identifies this window.



is_menu_visible ST3

ST3 is_menu_visible() # => bool

Returns True if the menu is visible.



is_minimap_visible ST3

ST3 is_minimap_visible() # => bool

Returns True if the minimap is enabled.



is_sidebar_visible ST3

ST3 is_sidebar_visible() # => bool

Returns True if the sidebar will be shown when contents are available.



is_status_bar_visible ST3

ST3 is_status_bar_visible() # => bool

Returns True if the status bar will be shown.



lookup_symbol_in_index ST3

ST3 lookup_symbol_in_index(symbol) # => [location]

Returns all locations where the symbol is defined across files in the current project.



lookup_symbol_in_open_files ST3

ST3 lookup_symbol_in_open_files(symbol) # => [location]

Returns all locations where the symbol is defined across open files.



new_file ST2≠3

ST2 new_file() # => View

Creates a new file. The returned view will be empty, and its is_loaded method will return True.



ST3 new_file() # => View

Creates a new file. The returned view will be empty, and its is_loaded() method will return True.



num_groups ST2&3

ST2&3 num_groups() # => int

Returns the number of view groups in the window.



open_file ST2≠3

ST2 open_file(file_name, <flags>) # => View

Opens the named file, and returns the corresponding view. If the file is already opened, it will be brought to the front. Note that as file loading is asynchronous, operations on the returned view won't be possible until its is_loading() method returns False.

The optional flags parameter is a bitwise combination of:

  • sublime.ENCODED_POSITION. Indicates the file_name should be searched for a :row or :row:col suffix
  • sublime.TRANSIENT. Open the file as a preview only: it won't have a tab assigned it until modified



ST3 open_file(file_name, <flags>) # => View

Opens the named file, and returns the corresponding view. If the file is already opened, it will be brought to the front. Note that as file loading is asynchronous, operations on the returned view won't be possible until its is_loading() method returns False.

The optional flags parameter is a bitwise combination of:

  • sublime.ENCODED_POSITION: Indicates the file_name should be searched for a :row or :row:col suffix
  • sublime.TRANSIENT: Open the file as a preview only: it won't have a tab assigned it until modified



panels ST3

ST3 panels() # => [str]

Returns a list of the names of all panels that have not been marked as unlisted. Includes certain built-in panels in addition to output panels.



project_data ST3

ST3 project_data() # => dict

Returns the project data associated with the current window. The data is in the same format as the contents of a .sublime-project file.



project_file_name ST3

ST3 project_file_name() # => str

Returns name of the currently opened project file, if any.



run_command ST2≠3

ST2 run_command(string, <args>) # => None

Runs the named WindowCommand with the (optional) given arguments.



ST3 run_command(string, <args>) # => None

Runs the named WindowCommand with the (optional) given args. This method is able to run any sort of command, dispatching the command via input focus.



set_menu_visible ST3

ST3 set_menu_visible(flag) # => None

Controls if the menu is visible.



set_minimap_visible ST3

ST3 set_minimap_visible(flag) # => None

Controls the visibility of the minimap.



set_project_data ST3

ST3 set_project_data(data) # => None

Updates the project data associated with the current window. If the window is associated with a .sublime-project file, the project file will be updated on disk, otherwise the window will store the data internally.



set_sidebar_visible ST3

ST3 set_sidebar_visible(flag) # => None

Sets the sidebar to be shown or hidden when contents are available.



set_status_bar_visible ST3

ST3 set_status_bar_visible(flag) # => None

Controls the visibility of the status bar.



set_tabs_visible ST3

ST3 set_tabs_visible(flag) # => None

Controls if tabs will be shown for open files.



set_view_index ST2≠3

ST2 set_view_index(view, group, index) # => None

Moves the view to the given group and index.



ST3 set_view_index(view, group, index) # => None

Moves the view to the given group and index.



show_input_panel ST2≠3

ST2 show_input_panel(caption, initial_text, on_done, on_change, on_cancel) # => View

Shows the input panel, to collect a line of input from the user. on_done and on_change, if not None, should both be functions that expect a single string argument. on_cancel should be a function that expects no arguments. The view used for the input widget is returned.



ST3 show_input_panel(caption, initial_text, on_done, on_change, on_cancel) # => View

Shows the input panel, to collect a line of input from the user. on_done and on_change, if not None, should both be functions that expect a single string argument. on_cancel should be a function that expects no arguments. The view used for the input widget is returned.



show_quick_panel ST2≠3

ST2 show_quick_panel(items, on_done, <flags>) # => None

Shows a quick panel, to select an item in a list. on_done will be called once, with the index of the selected item. If the quick panel was cancelled, on_done will be called with an argument of -1.

Items may be an array of strings, or an array of string arrays. In the latter case, each entry in the quick panel will show multiple rows.

Flags currently only has one option, sublime.MONOSPACE_FONT



ST3 show_quick_panel(items, on_done, <flags>, <selected_index>, <on_highlighted>) # => None

Shows a quick panel, to select an item in a list. on_done will be called once, with the index of the selected item. If the quick panel was cancelled, on_done will be called with an argument of -1.

items may be a list of strings, or a list of string lists. In the latter case, each entry in the quick panel will show multiple rows.

flags is a bitwise OR of sublime.MONOSPACE_FONT and sublime.KEEP_OPEN_ON_FOCUS_LOST

on_highlighted, if given, will be called every time the highlighted item in the quick panel is changed.



status_message ST3

ST3 status_message(string) # => None

Show a message in the status bar.



views ST2≠3

ST2 views() # => [View]

Returns all open views in the window.



ST3 views() # => [View]

Returns all open views in the window.



views_in_group ST2≠3

ST2 views_in_group(group) # => [View]

Returns all open views in the given group.



ST3 views_in_group(group) # => [View]

Returns all open views in the given group.




Generated from the official documentation on Sat Oct 29 20:16:49 EEST 2016 by Leonid Shevtsov.