Menus
See Also
- Documentation on menus
- Explains how menus work and what you can do with them.
File Format
| Format | Description |
|---|---|
| Format | JSON (with comments) |
| Extension | .sublime-menu |
| Name | One out of the list of available menus. See Available Menus for the complete name list and what menu they represent. |
| Location | Any under Packages |
| Content | A list of Menu Item objects |
Example
The following is an excerpt from the default Main.sublime-menu file.
[
{
"caption": "Edit",
"mnemonic": "E",
"id": "edit",
"children":
[
{ "command": "undo", "mnemonic": "U" },
{ "command": "redo_or_repeat", "mnemonic": "R" },
{
"caption": "Undo Selection",
"children":
[
{ "command": "soft_undo" },
{ "command": "soft_redo" }
]
},
{ "caption": "-", "id": "clipboard" },
{ "command": "copy", "mnemonic": "C" },
{ "command": "cut", "mnemonic": "t" },
{ "command": "paste", "mnemonic": "P" },
{ "command": "paste_and_indent", "mnemonic": "I" },
{ "command": "paste_from_history", "caption": "Paste from History" }
]
}
]2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Menu Item Objects
Menu items may have the following properties.
Unless you are referencing an existing item via ID, each menu item must define either children, command or caption.
commandName of the command to be called when the menu item is selected.
argsObject of arguments to the command. For Side Bar and Side Bar Mount Point menus, this is extended by a
filesargument that contains all selected items in the sidebar as a list.captionText to be displayed in the menu. A single hyphen (
-) turns the item into a Menu Separator.childrenList of Menu Item objects that are displayed when the item is hovered. Overrides existence of
commandproperty.mnemonicA single character used for menu accelerators. The character must be contained in the caption and is case-sensitive.
idA unique string identifier for the menu item. This can be used to extend menu sections or sub-menu or to alter a menu item entirely.
Refer to the main documentation on how this works.
platformThe platform name for which the menu entry should be made visible. Valid values are
OSX,Linux&Windows. It also supports negation in the form!OSXwhich means to show the menu entry for all platforms exceptOSX.