Sublime Forum

Custom hotkey for Navigate > File history

#1

Hello:

I’m trying to set Ctrl+Shift+H to do the same as Navigate > File history, but the following doesn’t work in Default (Windows).sublime-keymap , with or without args. (It pulls up some other screen, not the popup you get when going through “Navigate > File history”).

Any help welcome - thanks!

[

{

    "keys": ["ctrl+shift+h"],

    "command": "file_history",

    "args": {"command": "file_history"}

}

]

0 Likes

#2

For what you’re trying to do here, what you want is the following:

    {
        "keys": ["ctrl+shift+h"],
        "command": "show_command_palette",
        "args": {"command": "file_history"}
    }

This tells the Command Palette to open and run the command file_history. That will show you the list of files, allowing you to choose one; this is what the menu does.

If you invoke the command directly from a key binding, it skips over showing you the list of files because it assumes that you’re telling it to show you the history for a specific file directly.

For example:

    {
        "keys": ["ctrl+shift+h"],
        "command": "file_history",
        "args": {"path": ".gitignore"}
    },
1 Like

#3

This makes so much sense! Did not think of that - thank you : )

1 Like