Sublime Forum

Key binding for 'Move Commit [Up|Down]'

#1

How do I find the command information to add key bindings in Sublime Merge?
I’d like to add key bindings for:

  • Move Commit Up
  • Move Commit Down
  • Squash With Parent
1 Like

#2

Best place to look is within Package directory of installation directory (e.g.: C:\Program Files\Sublime Merge\Packages).

Packages of interest are Default.sublime-package and Default - Merge.sublime-settings

The following is part of my custom bindings and contains some of your requested bindings.

    //
    // Commit List
    //

    {   // Rename Branch
        "keys": ["f2"],
        "command": "show_command_palette",
        "args": {"command": "rename_branch"}
    },
    {   // Merge Branch
        "keys": ["ctrl+k", "ctrl+m"],
        "command": "show_command_palette",
        "args": {"command": "merge_branch"}
    },
    {   // Rebase Branch
        "keys": ["ctrl+k", "ctrl+r"],
        "command": "show_command_palette",
        "args": {"command": "rebase_branch"}
    },
    {   // Cherry Pick Commit
        "keys": ["ctrl+k", "ctrl+c"],
        "command": "cherry_pick",
        "args": {"commit": "$commit", "mode":"commit"}
    },
    {   // Squash Commits
        "keys": ["ctrl+k", "ctrl+s"],
        "command": "squash_commits",
        "args": {"commit": "$commit"}
    },
    {   // Fixup Commits
        "keys": ["ctrl+k", "ctrl+f"],
        "command": "fixup_commits",
        "args": {"commit": "$commit"}
    },
    {   // Move Commit Up
        "keys": ["ctrl+shift+up"],
        "command": "move_commit",
        "args": { "commit": "$commit", "down": false }
    },
    {   // Move Commit Down
        "keys": ["ctrl+shift+down"],
        "command": "move_commit",
        "args": { "commit": "$commit", "down": true }
    },

    {
        "keys": ["ctrl+r", "ctrl+s"],
        "command": "reset",
        "args": {"commit": "$commit", "mode": "soft"}
    },
    {
        "keys": ["ctrl+r", "ctrl+m"],
        "command": "reset",
        "args": {"commit": "$commit", "mode": "mixed"}
    },
    {
        "keys": ["ctrl+r", "ctrl+h"],
        "command": "reset",
        "args": {"commit": "$commit", "mode": "hard"}
    },
    {
        "keys": ["ctrl+shift+alt+z"],
        "command": "git_undo"
    },
    {
        "keys": ["ctrl+shift+alt+y"],
        "command": "git_redo"
    },
3 Likes

#3

Thanks, that was just what I needed.
In case anyone wants it, this is the other key binding I looked up and added:

	{   // Squash with Parent
        "keys": ["ctrl+alt+shift+left"],
		"command": "squash_commit",
	},
0 Likes

#4

Thanks, this is just what I was looking for! For Mac users, the path is:

/Applications/Sublime Merge.app/Contents/MacOS/Packages/
0 Likes