WARNING! This documentation is for an old, unsupported version of Sublime Text. Please check out the current docs.

Menus

Menus in Sublime Text, including both the main menu and context menu, are controlled by XML files, with the extension .sublime-menu. A simple example:

<menu>
    <menu caption="File">
        <item caption="New" command="new"/>
        <item caption="Open" command="open"/>
    </menu>
</menu>

For the main menu, the file Packages/Default/Main.sublime-menu is used. For the context menu, Packages/Default/Context.sublime-menu is used.

Menu files are made up menu elements, each of which may contain menu elements or item elements. Items have caption and command attributes. Menus may also contain separator elements, which are drawn as a horizontal bar, separating logical groups of items.

Captions may contain ampersands, which indicate that the following character should be underlined, allowing it to be selected via the keyboard. To include an actual ampersand in a caption, use two ampersands in a row.

Package Menus

To make a package with menu items that get inserted in the main menu, you can create .package-menu files. All .package-menu files are automatically placed under the Tools/Packages menu. The syntax of a .package-menu file is identical to a .sublime-menu file. For an example, take a look at Packages/Default/WordCount.package-menu.