Sublime Forum

Keyboard shortcut to copy short hash of selected commit?

#1

I see code in this thread which lets me copy a short hash for the right-clicked commit. (The full hash menu item also exists by default.) But I want to do the copy with a keyboard shortcut. How can I achieve this?

0 Likes

#2

The answer is to put this in SM’s .sublime-keymap file:

[
    // Probably other stuff…
    {
        "keys": [
            "super+ctrl+l"
        ],
        "command": "copy_to_clipboard",
        "args": {
            "text": "$short_commit"
        }
    }
]

Available text arguments include: $commit, $short_commit, $commit_message, $head, $native_git_dir, and a few others. Thanks to @djohnston for his Discord post laying this out!

0 Likes