Sublime Forum

Add 'Show Unsaved Changes...' to Command palette

#1

As title says.

I open the command palette, type diff and the only options appearing are related to git.

I want to use this feature without having to remove my hands from the keyboard and click the mouse to get the context menu.

0 Likes

#2

If your keyboard is an extended keyboard that contains a context menu key, pressing that key will open the context menu in Sublime (or you can bind a key to the context_menu command to do the same thing).

However, you can add commands to the Command Palette by creating a sublime-commands file in your User package (Preferences > Browse Packages...) that lists the commands that you’d like to be visible. For example, you could save the following content as User/CustomDiff.sublime-commands to have the command added:

[
    { "caption": "Show Unsaved Changes...", "command": "diff_changes" }
]

Of course, you can modify the caption to read whatever you like; this mimics the text that you see in the context menu. The command will be hidden in the command palette if it doesn’t apply to the current view.

2 Likes