### Define Python Comment Start Marker Source: https://docs.sublimetext.io/reference/comments.html This example shows how to define the start marker for comments in Python files. Ensure the scope selector matches the syntax you intend to target. ```xml name Miscellaneous scope source.python settings shellVariables name TM_COMMENT_START value # ``` -------------------------------- ### Python Command Execution Example Source: https://docs.sublimetext.io/guide/usage/build-systems.html Illustrates the command line execution of a Python script using the interpreter. This is an example of what the 'cmd' option in a build system might execute. ```bash python -u /path/to/current/file.ext ``` -------------------------------- ### PHP Array Completion Example Source: https://docs.sublimetext.io/guide/extensibility/completions.html This is an example of a completion snippet that expands to a PHP array structure. It demonstrates placeholder usage for callback functions and array names. ```php $arrayName = array('' => , ); ``` -------------------------------- ### Trigger-based Completions Source: https://docs.sublimetext.io/reference/completions.html Examples of trigger-based completions, showing how to define a 'trigger' and its corresponding 'contents'. The second example illustrates using a tab '\t' to add an annotation to the trigger. ```json { "trigger": "foo", "contents": "foobar" } ``` ```json { "trigger": "foo\ttest", "contents": "foobar" } ``` -------------------------------- ### Metadata 'settings' Key Example Source: https://docs.sublimetext.io/reference/metadata.html Demonstrates the required 'settings' key, which acts as a container for various metadata configurations. Its content is specific to the metadata's purpose. ```xml settings ... ``` -------------------------------- ### JavaScript Metadata Example Source: https://docs.sublimetext.io/reference/metadata.html This example defines metadata for JavaScript files, including comment markers and indentation rules. It also sets shell variables for comment syntax. ```xml name JavaScript Metadata scope source.js settings decreaseIndentPattern ^(.*\])?\s*\}.*$ increaseIndentPattern ^.*\{[^}"']*$ bracketIndentNextLinePattern (?x) ^ \s* \b(if|while|else)\b [^;]* $ | ^ \s* \b(for)\b .* $ shellVariables name TM_COMMENT_START value // name TM_COMMENT_START_2 value /* name TM_COMMENT_END_2 value */ uuid BC062860-3346-4D3B-8421-C5543F83D11F ``` -------------------------------- ### Python Build System Example Source: https://docs.sublimetext.io/guide/usage/build-systems.html A basic build system configuration for Python files. It specifies the command to run the Python interpreter with the current file and a regex to parse output for errors. ```json { "cmd": ["python", "-u", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.python" } ``` -------------------------------- ### Manual Installation (Linux) Source: https://docs.sublimetext.io/guide/getting-started/installation.html Install Sublime Text manually on Linux by downloading the archive, extracting it, and creating symbolic links for command-line access and desktop integration. Replace '3211' with the desired build number. ```bash cd ~ wget https://download.sublimetext.com/sublime_text_3_build_3211_x64.tar.bz2 tar vxjf sublime_text_3_build_*_x64.tar.bz2 # Move the uncompressed files to an appropriate location. sudo mv sublime_text_3 /opt/sublime_text # Create a symbolic link to use at the command line. sudo ln -s /opt/sublime_text_3/sublime_text /usr/local/bin/subl # Create a symbolic link for the desktop entry. sudo ln -s /opt/sublime_text_3/sublime_text.desktop /usr/share/applications/sublime_text.desktop ``` -------------------------------- ### Complete Package Definition with Metadata Source: https://docs.sublimetext.io/reference/package-control/repository.html This example shows a more complete package definition, including explicit 'name', 'homepage', 'donate' links, 'labels', and specific release requirements. 'details' must always be provided for package submissions. ```json { "packages": [ { "name": "Solarized Color Scheme", "details": "https://github.com/braver/Solarized", "homepage": "https://ethanschoonover.com/solarized/", "donate": "https://paypal.me/koenlageveen", "labels": ["color scheme"], "releases": [ { "sublime_text": ">=3000", "tags": true } ] } ] } ``` -------------------------------- ### Example Scoped Settings in XML Source: https://docs.sublimetext.io/reference/color_schemes_legacy.html This XML structure demonstrates how to define settings for a specific scope, such as comments, including foreground color. ```xml ... name Comment scope comment settings foreground #75715E ... ``` -------------------------------- ### Distribute coverage.py as Wheel for Python 3.3 on Windows x32 Source: https://docs.sublimetext.io/reference/package-control/repository.html Example of distributing the 'coverage' library using a Wheel file for Windows x32 with Python 3.3. Specifies platform, Python version, and URL. ```json { "platforms": ["windows-x32"], "python_versions": ["3.3"], "version": "4.2.0", "url": "https://files.pythonhosted.org/packages/a0/34/1185348cc5c541bbdf107438f0f0ea9df5d9a4233a974e9228b6ee815489/coverage-4.2-cp33-cp33m-win32.whl" } ``` -------------------------------- ### channel.json Repositories Configuration Source: https://docs.sublimetext.io/reference/package-control/channel.html Example of the 'repositories' array in channel.json. It specifies locations for package repositories, supporting HTTPS URLs, local file paths, and git hosting platforms. ```json { "$schema": "sublime://packagecontrol.io/schemas/channel", "schema_version": "4.0.0", "repositories": [ "https://packagecontrol.io/packages.json", "./local/repository.json", "file:///absolute/path/to/repository.json", "https://github.com/buymeasoda/soda-theme", "https://github.com/SublimeText" ], } ``` -------------------------------- ### Distribute coverage.py as Wheel for Python 3.8 on Windows Source: https://docs.sublimetext.io/reference/package-control/repository.html Example of distributing the 'coverage' library using a Wheel file for Windows x64 with Python 3.8. Specifies platform, Python version, and URL. ```json { "name": "coverage", "author": "nedbatchelder", "description": "coverage.py - http://coverage.readthedocs.org/en/latest/", "homepage": "https://pypi.org/project/coverage/", "issues": "https://github.com/nedbat/coveragepy/issues", "releases": [ { "platforms": ["windows-x64"], "python_versions": ["3.8"], "version": "7.3.2", "url": "https://files.pythonhosted.org/packages/9f/95/436887935a32fcead76c9f60b61f3fcd8940d4129bdbc50e2988e037a664/coverage-7.3.2-cp38-cp38-win_amd64.whl" } ``` -------------------------------- ### Markdown Footnote Example Source: https://docs.sublimetext.io/contributing.html Demonstrates the syntax for creating footnotes in Markdown, including the use of link-like definitions for footnote content. ```markdown I am text with a footnote[^1]. [^1]: This footnote can use **Markdown**, such as [hyperlinks](#). ``` -------------------------------- ### Distribute coverage.py as Wheel for Python 3.3 on Windows x64 Source: https://docs.sublimetext.io/reference/package-control/repository.html Example of distributing the 'coverage' library using a Wheel file for Windows x64 with Python 3.3. Specifies platform, Python version, and URL. ```json { "platforms": ["windows-x64"], "python_versions": ["3.3"], "version": "4.2.0", "url": "https://files.pythonhosted.org/packages/a0/34/1185348cc5c541bbdf107438f0f0ea9df5d9a4233a974e9228b6ee815489/coverage-4.2-cp33-cp33m-win32.whl" } ``` -------------------------------- ### Distribute coverage.py as Wheel for Python 3.8 on Linux Source: https://docs.sublimetext.io/reference/package-control/repository.html Example of distributing the 'coverage' library using a Wheel file for Linux x64 with Python 3.8. Specifies platform, Python version, and URL. ```json { "platforms": ["linux-x64"], "python_versions": ["3.8"], "version": "7.3.2", "url": "https://files.pythonhosted.org/packages/8d/1a/e4d0775502fae6ce2c2dd3692a66aff3b18e89757567e35680b9c63d89c5/coverage-7.3.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl" } ``` -------------------------------- ### Distribute coverage.py as Wheel for Python 3.3 on Linux x32 Source: https://docs.sublimetext.io/reference/package-control/repository.html Example of distributing the 'coverage' library using a Wheel file for Linux x32 with Python 3.3. Specifies platform, Python version, and URL. ```json { "platforms": ["linux-x32"], "python_versions": ["3.3"], "version": "4.3.4", "url": "https://files.pythonhosted.org/packages/c1/cd/a35e25680822d400e2a32d1eddd017087a9cef78e3fd5dc29541d8051a58/coverage-4.3.4-cp33-cp33m-manylinux1_i686.whl" } ``` -------------------------------- ### Distribute coverage.py as Wheel for Python 3.3 on Linux x64 Source: https://docs.sublimetext.io/reference/package-control/repository.html Example of distributing the 'coverage' library using a Wheel file for Linux x64 with Python 3.3. Specifies platform, Python version, and URL. ```json { "platforms": ["linux-x64"], "python_versions": ["3.3"], "version": "4.3.4", "url": "https://files.pythonhosted.org/packages/8a/0f/5221822805edf3fc13e85c278de6451a5c08d0fd67e2c86e67e48b683a20/coverage-4.3.4-cp33-cp33m-manylinux1_x86_64.whl" } ``` -------------------------------- ### Messages Configuration (`messages.json`) Source: https://docs.sublimetext.io/guide/package-control/utilities.html Configure messages to be displayed to users when a package is installed or upgraded. The `messages.json` file in the root of your package maps event keys ('install' or version numbers) to relative file paths containing the message content. ```APIDOC ## messages.json Configuration ### Description Defines messages to be shown to users upon package installation or upgrade. ### File Structure Place `messages.json` in the root directory of your package. ### Content Structure Each key in the JSON object represents an event or version, and its value is a relative file path to the message content. - **`"install"`** (string): Path to the message file displayed when the package is first installed. - **`""`** (string): Path to the message file displayed when the package is upgraded to this specific version. Package Control will display messages for all versions greater than the user's currently installed version. ### Example ```json { "install": "messages/install.txt", "1.1.1": "messages/1.1.1.txt", "1.2.0": "messages/1.2.0.txt" } ``` ``` -------------------------------- ### Distribute coverage.py as Wheel for Python 3.8 on macOS Source: https://docs.sublimetext.io/reference/package-control/repository.html Example of distributing the 'coverage' library using a Wheel file for macOS x64 with Python 3.8. Specifies platform, Python version, and URL. ```json { "platforms": ["osx-x64"], "python_versions": ["3.8"], "version": "7.3.2", "url": "https://files.pythonhosted.org/packages/a0/a6/9deeff0c49d865cd1c5ae5efc9442ff234f9b0e9d15cb4a9cda58ec255cc/coverage-7.3.2-cp38-cp38-macosx_10_9_x86_64.whl" } ``` -------------------------------- ### Distribute coverage.py as Wheel for Python 3.3 on macOS x64 Source: https://docs.sublimetext.io/reference/package-control/repository.html Example of distributing the 'coverage' library using a Wheel file for macOS x64 with Python 3.3. Specifies platform, Python version, and URL. ```json { "platforms": ["osx-x64"], "python_versions": ["3.3"], "version": "4.3.4", "url": "https://files.pythonhosted.org/packages/ac/dc/3e2d996c440a1a589f3323e806cf96d3c64650579483c3798ef2ea34b51a/coverage-4.3.4-cp33-cp33m-macosx_10_10_x86_64.whl" } ``` -------------------------------- ### Completions with Metadata Source: https://docs.sublimetext.io/reference/completions.html An example of a completion entry that includes metadata fields like 'annotation', 'kind', and 'details' to customize its appearance and information in the completions list. ```json { "trigger": "func", "contents": "funcbar", "annotation": "function", "kind": "function", "details": "A short description of what this string function does." } ``` -------------------------------- ### Basic Mouse Drag Select Example Source: https://docs.sublimetext.io/reference/mouse_bindings.html This JSON snippet defines basic mouse bindings for drag selection. It includes configurations for single clicks, control-clicks, and alt-clicks with different arguments. ```json [ // Basic drag select { "button": "button1", "count": 1, "press_command": "drag_select" }, { "button": "button1", "count": 1, "modifiers": ["ctrl"], "press_command": "drag_select", "press_args": {"additive": true} }, { "button": "button1", "count": 1, "modifiers": ["alt"], "press_command": "drag_select", "press_args": {"subtractive": true} }, ] ``` -------------------------------- ### Example Sublime Text Project File Source: https://docs.sublimetext.io/reference/projects.html This JSON structure defines a Sublime Text project, including folders to include, project-specific settings, and custom build systems. ```json { "folders": [ { "path": "src", "folder_exclude_patterns": ["backup"] }, { "path": "docs", "name": "Documentation", "file_exclude_patterns": ["*.css"] } ], "settings": { "tab_size": 8 }, "build_systems": [ { "name": "List", "cmd": ["ls"] } ] } ``` -------------------------------- ### Multi-cursor Completion Example (Working) Source: https://docs.sublimetext.io/guide/extensibility/completions.html Illustrates a scenario where Sublime Text can handle completions with multiple cursors. This works when all cursors share the same text up to the last word separator. ```text l| some text with l| l| and.l| ``` -------------------------------- ### channel.json Packages Cache Example Source: https://docs.sublimetext.io/reference/package-control/channel.html Demonstrates the 'packages_cache' property in channel.json. This cache stores fully resolved package information from various repositories to optimize HTTP requests. ```json { "packages_cache": { "https://packagecontrol.io/packages.json": [ { "name": "Alignment", "description": "Multi-line and multiple selection alignment plugin", "author": "wbond", "homepage": "http://wbond.net/sublime_packages/alignment", "releases": [ { "version": "2.0.0", "date": "2011-09-18 20:12:41", "url": "https://packagecontrol.io/Alignment.sublime-package", "sublime_text": "*" } ] } ] } } ``` -------------------------------- ### Markdown Semantic Linefeeds Example Source: https://docs.sublimetext.io/contributing.html Demonstrates semantic linefeeds for splitting text within Markdown files to maintain readability and adhere to line width constraints. ```markdown - This sentence can be split using a semantic linefeed, as mentioned earlier. 1. The very same thing applies to this line, but it uses a three-spaces indent instead. 1. You could also indent this block by 4 spaces. ``` -------------------------------- ### YAML Pattern Match Example Source: https://docs.sublimetext.io/guide/extensibility/syntaxdefs.html This YAML snippet demonstrates a basic pattern match rule. It uses a regular expression to find matches and assigns a scope name to them. ```yaml match: (?i:m)y \s+[Rr]egex name: string.format comment: This comment is optional. ``` -------------------------------- ### Multi-cursor Completion Example (Not Working) Source: https://docs.sublimetext.io/guide/extensibility/completions.html Demonstrates a scenario where Sublime Text cannot handle completions with multiple cursors. This occurs when cursors do not share the same text up to the last word separator. ```text l| some text with la| l| andl| ``` -------------------------------- ### Handle Package Events in Sublime Text Plugins Source: https://docs.sublimetext.io/guide/package-control/utilities.html Implement plugin_loaded and plugin_unloaded functions to respond to package installation, upgrade, and removal events using the package_control.events API. Ensure the package name is correctly specified. ```python import sys package_name = 'My Package' def plugin_loaded(): from package_control import events if events.install(package_name): print('Installed %s!' % events.install(package_name)) elif events.post_upgrade(package_name): print('Upgraded to %s!' % events.post_upgrade(package_name)) def plugin_unloaded(): from package_control import events if events.pre_upgrade(package_name): print('Upgrading from %s!' % events.pre_upgrade(package_name)) elif events.remove(package_name): print('Removing %s!' % events.remove(package_name)) ``` -------------------------------- ### Markdown Hyperlink with Deferred Definition Example Source: https://docs.sublimetext.io/contributing.html Provides an example of using deferred definitions for hyperlinks in Markdown, promoting cleaner text and descriptive link text. ```markdown This is some normal text. Information on "text" can be found [on Wikipedia][wiki-text]. [wiki-text]: https://en.wikipedia.org/wiki/Text ``` -------------------------------- ### Configuration and Settings Commands Source: https://docs.sublimetext.io/reference/commands.html Commands for setting build systems, window layouts, line endings, and user settings. ```APIDOC ## POST /set_build_system ### Description Changes the current build system. ### Method POST ### Endpoint /set_build_system ### Parameters #### Request Body - **file** (String) - Optional - Path to the build system. If empty, Sublime Text tries to automatically find an appropriate build systems from specified selectors. - **index** (Int) - Optional - Used in the **Tools | Build System** menu but otherwise probably not useful. ``` ```APIDOC ## POST /set_layout ### Description Changes the group layout of the current window. This command uses the same pattern as `Window.set_layout`, see there for a list and explanation of parameters. ### Method POST ### Endpoint /set_layout ``` ```APIDOC ## POST /set_line_ending ### Description Changes the line endings of the current file. ### Method POST ### Endpoint /set_line_ending ### Parameters #### Request Body - **type** (Enum) - Required - _windows_, _unix_, or _cr_. ``` ```APIDOC ## POST /set_mark ### Description Marks the position of each caret in the current file. If any marks have already been set in that file, they are removed. ### Method POST ### Endpoint /set_mark ``` ```APIDOC ## POST /set_setting ### Description Set the value of a setting. This value is view-specific. ### Method POST ### Endpoint /set_setting ### Parameters #### Request Body - **setting** (String) - Required - The name of the setting to changed. - **value** (*) - Required - The value to set to. ``` ```APIDOC ## POST /set_user_setting ### Description Set the value of a setting in a .sublime-settings file. ### Method POST ### Endpoint /set_user_setting ### Parameters #### Request Body - **file** (String) - Required - The name of the sublime-settings file to change the setting in. - **setting** (String) - Required - The name of the setting to changed. - **value** (*) - Required - The value to set to. ``` -------------------------------- ### Asset Configuration with Version and Build Placeholders Source: https://docs.sublimetext.io/reference/package-control/repository.html Use placeholders like '${version}', '${st_build}', and '${platform}' to match assets more explicitly. The 'platforms' key must list supported platforms for '${platform}' to work. '${st_build}' matches Sublime Text build numbers, and '${version}' matches the semver without the tag prefix. ```json { "packages": [ { "details": "https://github.com/SublimeText/Less", "releases": [ { "asset": "Less-${version}-st${st_build}.sublime-package", "sublime_text": "4107 - 4148" }, { "asset": "Less-${version}-st${st_build}.sublime-package", "sublime_text": ">=4149" } ] }, { "details": "https://github.com/SublimeText/Less", "releases": [ { "asset": "Less-*.*.*-st4107.sublime-package", "sublime_text": "4107 - 4148" }, { "asset": "Less-*.*.*-st4149.sublime-package", "sublime_text": ">=4149" } ] }, { "details": "https://github.com/SublimeText/PackageWithAsset", "releases": [ { "asset": "FileName-${platform}.sublime-package", "platforms": ["linux-arm64", "linux-x64", "osx-arm64", "osx-x64", "windows-x64"] } ] } ] } ``` -------------------------------- ### Create a 'Hello, World!' Text Command Plugin Source: https://docs.sublimetext.io/guide/extensibility/plugins This is a basic Sublime Text plugin that inserts 'Hello, World!' into the current view. It requires the 'sublime' and 'sublime_plugin' modules. Save this file as 'Packages/User/hello_world.py'. ```python import sublime import sublime_plugin class ExampleCommand(sublime_plugin.TextCommand): def run(self, edit): self.view.insert(edit, 0, "Hello, World!") ``` -------------------------------- ### Define Package Messages with messages.json Source: https://docs.sublimetext.io/guide/package-control/utilities.html Use a messages.json file in your package root to specify text files to display to users on install or upgrade. Keys can be 'install' or version numbers. ```json { "install": "messages/install.txt", "1.1.1": "messages/1.1.1.txt", "1.2.0": "messages/1.2.0.txt" } ``` -------------------------------- ### Regular Expression Example Source: https://docs.sublimetext.io/guide/usage/search-and-replace.html This is an example of a regular expression pattern that can be used in Sublime Text's search and replace functionality. Ensure regular expressions are enabled in the search panel to use such patterns. ```regex (?:Sw|P)i(?:tch|s{2})\s(?:it\s)?of{2}! ``` -------------------------------- ### Window and Overlay Commands Source: https://docs.sublimetext.io/reference/commands.html Commands for showing windows, overlays, and panels. ```APIDOC ## POST /show_about_window ### Description Shows the About Sublime Text window. ### Method POST ### Endpoint /show_about_window ``` ```APIDOC ## POST /show_at_center ### Description Scrolls the view to show the selected line in the middle of the view and adjusts the horizontal scrolling if necessary. ### Method POST ### Endpoint /show_at_center ``` ```APIDOC ## POST /show_overlay ### Description Shows the requested overlay. Use the `hide_overlay` command to hide it. ### Method POST ### Endpoint /show_overlay ### Parameters #### Request Body - **overlay** (Enum) - Required - The type of overlay to show. Possible values: `goto`, `command_palette`. - **show_files** (Bool) - Optional - If using the goto overlay, start by displaying files rather than an empty widget. - **text** (String) - Optional - The initial contents to put in the overlay. ``` ```APIDOC ## POST /show_panel ### Description Shows a panel. ### Method POST ### Endpoint /show_panel ### Parameters #### Request Body - **panel** (String) - Required - Values: `incremental_find`, `find`, `replace`, `find_in_files`, `console` or `output.`. You can acquire a list of all currently existing panels by running `window.panels()` in the console. - **pattern** (String) - Optional - The search string/pattern to add to the _Find:_ field. (ST 4123+) - **replace_pattern** (String) - Optional - The replacement string to add to the _Replace:_ field. (ST 4123+) - **reverse** (Bool) - Optional - Whether to search backwards in the buffer. - **toggle** (Bool) - Optional - Whether to hide the panel if it's already visible. - **highlight** (Bool) - Optional - Whether to highlight find results. (ST 4107+) - **in_selection** (Bool) - Optional - Whether to search within current selection only. (ST 4107+) - **preserve_case** (Bool) - Optional - Whether to preserve original casing when replacing text. (ST 4107+) - **regex** (Bool) - Optional - Whether to perform regular expression matching. (ST 4107+) - **use_gitignore** (Bool) - Optional - Whether to exclude git-ignored files from `find_in_files` search run. (ST4107+) - **whole_word** (Bool) - Optional - Whether to search for whole words only. (ST4107+) - **wrap** (Bool) - Optional - Whether to continue search at the beginning of a document if end of file is reached. (ST4107+) ``` ```APIDOC ## POST /show_scope_name ### Description Shows the name for the caret's scope in the status bar. ### Method POST ### Endpoint /show_scope_name ``` -------------------------------- ### Start Sublime Text from Git Bash Source: https://docs.sublimetext.io/guide/example-setups/julia.html Use this batch command to start Sublime Text from Git Bash, ensuring that terminals opened within Sublime Text also use Git Bash. ```batch cmd /C start "" "%PROGRAMFILES%\Git\bin\sh.exe" --login -i -c "exec \"C:\Users\PetrKrysl\Documents\Productivity\PortableSublimeText\sublime_text.exe\"" ``` -------------------------------- ### Disable Indentation for Comment Start Source: https://docs.sublimetext.io/reference/comments.html Setting 'TM_COMMENT_DISABLE_INDENT' to 'yes' prevents indentation when using the TM_COMMENT_START marker. ```xml name TM_COMMENT_DISABLE_INDENT value yes ``` -------------------------------- ### Define Comment End Marker Source: https://docs.sublimetext.io/reference/comments.html This example defines an end marker for block comments. If omitted, TM_COMMENT_START is treated as a line comment. ```xml name TM_COMMENT_END_2 value */ ``` -------------------------------- ### Define Basic Key Bindings Source: https://docs.sublimetext.io/guide/customization/key_bindings.html Use this format to define simple key bindings that map key sequences to commands. This is the fundamental structure for customizing shortcuts. ```json [ { "keys": ["ctrl+shift+n"], "command": "new_window" }, { "keys": ["ctrl+o"], "command": "prompt_open_file" } ] ``` -------------------------------- ### Markdown Unnumbered List Example Source: https://docs.sublimetext.io/contributing.html Illustrates the recommended hierarchy for unnumbered Markdown lists, using indentation to denote different levels. ```markdown - first level * second level ``` -------------------------------- ### Build Command Source: https://docs.sublimetext.io/reference/commands.html Runs a build system. ```APIDOC ## BUILD ### Description Runs a build system. ### Method N/A (Command) ### Endpoint N/A (Command) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **variant** (String) - Optional - The name of the variant to be run. ``` -------------------------------- ### Advanced Begin-End Rule Structure Source: https://docs.sublimetext.io/guide/extensibility/syntaxdefs.html A comprehensive structure for begin-end rules, including captures for start and end delimiters, and nested patterns. ```yaml name: contentName: begin: beginCaptures: '0': {name: } # ... end: endCaptures: '0': {name: } # ... patterns: - name: match: ``` -------------------------------- ### Menu Item Caption Source: https://docs.sublimetext.io/contributing.html Format menu item captions using an arrow (`→`) to denote hierarchy, starting from the main menu. ```markdown *Preferences → Package Settings → ...* ``` -------------------------------- ### Markdown Numbered List Example Source: https://docs.sublimetext.io/contributing.html Shows the preferred method for numbered Markdown lists, using '1.' for all items to facilitate easy reordering. ```markdown 1. This is the first item, but it may change places in the future. 1. By always using ``1.``, we can swap lines around without worrying about numbering. ``` -------------------------------- ### Basic Begin-End Rule Skeleton Source: https://docs.sublimetext.io/guide/extensibility/syntaxdefs.html A skeleton for defining rules that target code blocks delimited by start and end markers, such as literal strings. ```yaml name: begin: end: ``` -------------------------------- ### Symbol Text Transformation Regex Source: https://docs.sublimetext.io/reference/symbols.html This Perl-compatible regular expression transforms captured symbols, for example, simplifying 'class FooBar(object)' to 'FooBar(object)'. ```perl s/class\s+([A-Za-z_][A-Za-z0-9_]*.+?)\)?(\:|$)/$1/g; ``` -------------------------------- ### Basic Package Definition Source: https://docs.sublimetext.io/reference/package-control/repository.html A minimal package definition requires 'details' URL pointing to the repository (GitHub, Bitbucket, GitLab) and 'releases' information. All package information is retrieved from the 'details' URL. ```json { "packages": [ { "details": "https://github.com/wbond/sublime_alignment", "releases": [ { "sublime_text": "*", "tags": true } ] } ] } ``` -------------------------------- ### Asset Configuration with Globs Source: https://docs.sublimetext.io/reference/package-control/repository.html Use globs like '*' to match changing parts of asset file names if they differ for each version. Supported placeholders are '*' for any number of characters and '?' for a single character. ```json { "name": "A File Icon", "details": "https://github.com/SublimeText/AFileIcon", "releases": [ { "asset": "*.sublime-package" } ] } ``` -------------------------------- ### Configure Terminus Shells Source: https://docs.sublimetext.io/guide/example-setups/julia.html Customize the default shell for the Terminus package by editing the User/Terminus.sublime-settings file. This example shows how to set different shells for Windows and Linux/macOS. ```jsonc { // a list of available shells to execute // the shell marked as "default" will be the default shell "shell_configs": [ { "name": "Command Prompt", "cmd": "bash.exe", "env": {}, "enable": true, "default": true, "platforms": ["windows"] }, { "name": "Ubuntu 18.04 Login Shell", "cmd": "C:\\Program Files\\WindowsApps\\CanonicalGroupLimited.UbuntuonWindows_1804.2019.521.0_x64__79rhkp1fndgsc\\ubuntu.exe", "env": {}, "enable": true, "default": false, "platforms": ["windows"] }, { "name": "Bash", "cmd": ["bash", "-i", "-l"], "env": {}, "enable": true, "default": false, "platforms": ["linux", "osx"] }, { "name": "Zsh", "cmd": ["zsh", "-i", "-l"], "env": {}, "enable": true, "default": false, "platforms": ["linux", "osx"] } ], } ``` -------------------------------- ### Custom Tip Block Source: https://docs.sublimetext.io/contributing.html Use custom block types like 'tip' for special notes. This example shows how to add a 'tip' block with additional attributes. ```markdown ::: tip Added in build 4050 {added} ::: ``` -------------------------------- ### Set Window Layout with Python Source: https://docs.sublimetext.io/reference/python_api.html Use `Window.set_layout` to change the tile-based panel layout of view groups. Expects a dictionary defining columns, rows, and cell boundaries. ```python # A 2-column layout with a separator in the middle window.set_layout({ "cols": [0, 0.5, 1], "rows": [0, 1], "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] }) ``` ```python # A 2x2 grid layout with all separators in the middle window.set_layout({ "cols": [0, 0.5, 1], "rows": [0, 0.5, 1], "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [0, 1, 1, 2], [1, 1, 2, 2]] }) ``` ```python # A 2-column layout with the separator in the middle and the right # column being split in half window.set_layout({ "cols": [0, 0.5, 1], "rows": [0, 0.5, 1], "cells": [[0, 0, 1, 2], [1, 0, 2, 1], [1, 1, 2, 2]] }) ``` -------------------------------- ### Add Key Binding for Quick Switch Project Source: https://docs.sublimetext.io/guide/usage/file-management/projects.html This JSON snippet can be added to your user key bindings file to re-enable the 'Quick Switch Project' shortcut if it was removed in a build. ```JSON { "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" } ``` -------------------------------- ### Plain String Completion Equivalence Source: https://docs.sublimetext.io/reference/completions.html Demonstrates how a simple string completion is equivalent to a more verbose object with identical 'trigger' and 'contents' fields. ```json "foo" ``` ```json { "trigger": "foo", "contents": "foo" } ``` -------------------------------- ### Window and View Management Source: https://docs.sublimetext.io/reference/commands.html Commands for managing windows, views, and project-related actions. ```APIDOC ## new_window ### Description Opens a new window. ### Method Not specified (assumed to be a command invocation) ### Endpoint Not applicable ### Parameters None documented. ### Response No specific response documented. ``` ```APIDOC ## next_view_in_stack ### Description Switches to the most recently active view. ### Method Not specified (assumed to be a command invocation) ### Endpoint Not applicable ### Parameters None documented. ### Response No specific response documented. ``` ```APIDOC ## next_view ### Description Switches to the next view. ### Method Not specified (assumed to be a command invocation) ### Endpoint Not applicable ### Parameters None documented. ### Response No specific response documented. ``` ```APIDOC ## prev_view_in_stack ### Description Switches to the view that was active before the most recently active view. ### Method Not specified (assumed to be a command invocation) ### Endpoint Not applicable ### Parameters None documented. ### Response No specific response documented. ``` ```APIDOC ## prev_view ### Description Switches to the previous view. ### Method Not specified (assumed to be a command invocation) ### Endpoint Not applicable ### Parameters None documented. ### Response No specific response documented. ``` ```APIDOC ## prompt_add_folder ### Description Prompts for a folder to add to the current project. ### Method Not specified (assumed to be a command invocation) ### Endpoint Not applicable ### Parameters None documented. ### Response No specific response documented. ``` ```APIDOC ## prompt_open_project ### Description Prompts for a project file to open as a project. ### Method Not specified (assumed to be a command invocation) ### Endpoint Not applicable ### Parameters None documented. ### Response No specific response documented. ``` ```APIDOC ## prompt_select_project ### Description Opens a popup with recently accessed projects where you can fuzzy-search. ### Method Not specified (assumed to be a command invocation) ### Endpoint Not applicable ### Parameters None documented. ### Response No specific response documented. ``` ```APIDOC ## refresh_folder_list ### Description Reloads all folders in the current project and updates the side bar. Note that the folders are being reloaded in the background and the sidebar will not receive any updates until the process has been completed. ### Method Not specified (assumed to be a command invocation) ### Endpoint Not applicable ### Parameters None documented. ### Response No specific response documented. ``` -------------------------------- ### Example Key Binding Definition Source: https://docs.sublimetext.io/reference/key_bindings.html This JSON object defines a key binding that inserts a snippet. It includes conditions for when the binding should be active, such as when auto-indent is enabled and the caret is between curly braces. ```json { "keys": ["shift+enter"], "command": "insert_snippet", "args": {"contents": "\n\t$0\n"}, "context": [ { "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{\", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true } ] } ``` -------------------------------- ### Context Menu Command Source: https://docs.sublimetext.io/reference/commands.html Shows the context menu. ```APIDOC ## CONTEXT_MENU ### Description Shows the context menu. ### Method N/A (Command) ### Endpoint N/A (Command) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ``` -------------------------------- ### Markdown Heading Structure Example Source: https://docs.sublimetext.io/contributing.html Illustrates the correct hierarchical structure for Markdown headings, including YAML front matter for the page title and the required order of heading levels. ```markdown --- title: This will be heading 1 --- ## Heading 2 ### Heading 3 With text ### And proper spacing ## New Heading 2 ### This SHOULD NOT be a h4 ``` -------------------------------- ### Define Key Chords Source: https://docs.sublimetext.io/guide/customization/key_bindings.html Create key bindings that require a sequence of key presses, known as key chords. This example maps 'ctrl+k' followed by 'ctrl+v' to the 'paste_from_history' command. ```json { "keys": ["ctrl+k", "ctrl+v"], "command": "paste_from_history" } ```