Skip to content
Scott Kuroda edited this page Nov 25, 2013 · 3 revisions

This plugin includes a number of menu entries. However, if there is one you would like that is not currently available, you may add it yourself. This page will explain how to add various menu entries.

All command entries are JSON objects. These objects will, at a minimum, contain the keys command and caption. command is the string representation of the command to run. caption is the string that will appear in the menu. It may also contain the key args. The value for this entry is an object containing key value pairs of the arguments.

Main Menu

The plugin includes menu entries to access key bindings and settings. To add a custom entry, create Main.sublime-menu in the Packages/User folder. This file contains a list of objects specifying what command should be run for a given entry. A top level menu entry must contain the keys caption and children. It may optionally contain the keys id and mnemonic.

The id key is a string identifying the menu entry. If an entry already exists with a given id, you may specify the id, while leaving caption out. The children reference a list of command and/or sub menu entries. Finally, mnemonic contains a character that can be used to quickly access the entry.

The below sample will create menu entries under File.

[
    {
        "mnemonic": "f",
        "id": "file",
        "children":
        [
            { "caption": "-" },
            { "caption": "New File With Name", "mnemonic": "n", "command": "advanced_new_file_new" },
            { "caption": "Rename Current File", "mnemonic": "r", "command": "advanced_new_file_move" },
            { "caption": "Delete Current File","mnemonic": "d",  "command": "advanced_new_file_delete" }
        ]
    }
]

Side Bar Menu

Side bar context menu entries can be generated by creating Side Bar.sublime-menu in the Packages/User folder. These commands require special arguments dirs for directories and files for files. As such, only a subset of the commands are supported by default.

These are new file and move file. A sample of these commands can be seen below.

[
    { "caption": "ANF: New File", "command": "advanced_new_file_new_at", "args": {"dirs": []} },
    { "caption": "ANF: Move File", "command": "advanced_new_file_move_at", "args": {"files": []} }
]

Buffer Context Menu

To create a buffer context menu, create Context.sublime-menu in the Packages/User folder. A sample can be seen below.

[
    {"caption": "ANF: Rename", "command": "advanced_new_file_move" }
]
Clone this wiki locally