Skip to content

Instantly share code, notes, and snippets.

@renechz
Last active December 20, 2015 00:59
Show Gist options
  • Save renechz/6046145 to your computer and use it in GitHub Desktop.
Save renechz/6046145 to your computer and use it in GitHub Desktop.
SublimeGit keybindings for Vintage mode.
/* Keybindings for SublimeGit with Vintage mode enabled on OSX.
*
* Using Vim Fugitive keybindings when possible.
* Using "," as leader key.
*
* Work in progress.
* Definitely not a much advanced user of either Vim or Fugitive, but it's a start.
*/
[
/*** GIT STATUS ***/
// Refresh
{ "keys": ["r"], "command": "git_status_refresh",
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" },
{ "key": "setting.command_mode", "operand": false }
]
},
// Refresh - Vintage Mode
{ "keys": ["R"], "command": "git_status_refresh",
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" },
{ "key": "setting.command_mode", "operand": true }
]
},
// Section shortcuts
{ "keys": ["1"], "command": "git_status_move", "args": {"goto": "section:1"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" }
]
},
{ "keys": ["2"], "command": "git_status_move", "args": {"goto": "section:2"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" }
]
},
{ "keys": ["3"], "command": "git_status_move", "args": {"goto": "section:3"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" }
]
},
{ "keys": ["4"], "command": "git_status_move", "args": {"goto": "section:4"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" }
]
},
{ "keys": ["5"], "command": "git_status_move", "args": {"goto": "section:5"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" }
]
},
// Cycle through sections
{ "keys": ["N"], "command": "git_status_move", "args": {"goto": "section:next"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" }
]
},
{ "keys": ["P"], "command": "git_status_move", "args": {"goto": "section:prev"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" },
{ "key": "setting.command_mode", "operand": false }
]
},
// Cycle through sections - Vintage mode
{ "keys": [",", "P"], "command": "git_status_move", "args": {"goto": "section:prev"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" },
{ "key": "setting.command_mode", "operand": true }
]
},
// Cycle through files
{ "keys": ["n"], "command": "git_status_move", "args": {"goto": "item:next"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" },
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["p"], "command": "git_status_move", "args": {"goto": "item:prev"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" },
{ "key": "setting.command_mode", "operand": false }
]
},
// Cycle through files - Vintage Mode
{ "keys": ["ctrl+n"], "command": "git_status_move", "args": {"goto": "item:next"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" },
{ "key": "setting.command_mode", "operand": true }
]
},
{ "keys": ["ctrl+p"], "command": "git_status_move", "args": {"goto": "item:prev"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status" },
{ "key": "setting.command_mode", "operand": true }
]
},
// Stage command (global)
{ "keys": ["S"], "command": "git_status_stage", "args": {"stage": "unstaged"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"},
{ "key": "setting.command_mode", "operand": false }
]
},
// Stage command (global) - Vintage Mode
{ "keys": ["ctrl+S"], "command": "git_status_stage", "args": {"stage": "unstaged"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"},
{ "key": "setting.command_mode", "operand": true }
]
},
// Stage command (untracked)
{ "keys": ["s"], "command": "git_status_stage", "args": {"stage": "section"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.untracked_files"},
{ "key": "selector", "operator": "equal", "operand": "constant.other.git-status.header"},
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["s"], "command": "git_status_stage", "args": {"stage": "file"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.untracked_files"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": false }
]
},
// Stage command (untracked) - Vintage Mode
{ "keys": ["-"], "command": "git_status_stage", "args": {"stage": "file"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.untracked_files"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": true }
]
},
// Stage command (unstaged)
{ "keys": ["s"], "command": "git_status_stage", "args": {"stage": "section"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.unstaged_changes"},
{ "key": "selector", "operator": "equal", "operand": "constant.other.git-status.header"},
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["s"], "command": "git_status_stage", "args": {"stage": "file"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.unstaged_changes"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": false }
]
},
// Stage command (unstaged) - Vintage Mode
{ "keys": ["-"], "command": "git_status_stage", "args": {"stage": "file"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.unstaged_changes"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": true }
]
},
// Unstage command
{ "keys": ["U"], "command": "git_status_unstage", "args": {"unstage": "all"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"}
]
},
{ "keys": ["u"], "command": "git_status_unstage", "args": {"unstage": "all"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.staged_changes"},
{ "key": "selector", "operator": "equal", "operand": "constant.other.git-status.header"},
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["u"], "command": "git_status_unstage", "args": {"unstage": "file"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.staged_changes"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": false }
]
},
// Unstage command - Vintage Mode
{ "keys": ["-"], "command": "git_status_unstage", "args": {"unstage": "file"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.staged_changes"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": true }
]
},
// Discard command
{ "keys": ["k"], "command": "git_status_discard", "args": {"discard": "section"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "constant.other.git-status.header"},
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["k"], "command": "git_status_discard", "args": {"discard": "item"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["K"], "command": "git_status_discard", "args": {"discard": "all"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"}
]
},
// Discard command - Vintage Mode
{ "keys": ["backspace"], "command": "git_status_discard", "args": {"discard": "section"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "constant.other.git-status.header"},
{ "key": "setting.command_mode", "operand": true }
]
},
{ "keys": ["backspace"], "command": "git_status_discard", "args": {"discard": "item"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": true }
]
},
// Ignore command (only untracked)
{ "keys": ["i"], "command": "git_status_ignore",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.untracked_files"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["I"], "command": "git_status_ignore", "args": {"edit_pattern": true},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.untracked_files"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": false }
]
},
// Ignore command (only untracked) - Vintage mode
{ "keys": [".", "i"], "command": "git_status_ignore",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.untracked_files"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": true }
]
},
{ "keys": [",", "I"], "command": "git_status_ignore", "args": {"edit_pattern": true},
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.untracked_files"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": true }
]
},
// Open command
{ "keys": ["enter"], "command": "git_status_open_file",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"}
]
},
// Diff command
{ "keys": ["d"], "command": "git_status_diff",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": false }
]
},
// Diff command - Vintage mode
{ "keys": ["D"], "command": "git_status_diff",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": true }
]
},
// Stashes
{ "keys": ["z"], "command": "git_stash",
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"},
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["a"], "command": "git_status_stash_apply",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.stashes"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["A"], "command": "git_status_stash_pop",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.stashes"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": false }
]
},
// Stashes - Vintage mode
{ "keys": [",", "z"], "command": "git_stash",
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"},
{ "key": "setting.command_mode", "operand": true }
]
},
{ "keys": [",", "a"], "command": "git_status_stash_apply",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.stashes"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": true }
]
},
{ "keys": [",", "A"], "command": "git_status_stash_pop",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.stashes"},
{ "key": "selector", "operator": "equal", "operand": "meta.git-status.line"},
{ "key": "setting.command_mode", "operand": true }
]
},
// Commit command
{ "keys": ["c"], "command": "git_commit",
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"},
{ "key": "setting.command_mode", "operand": false }
]
},
{ "keys": ["C"], "command": "git_commit", "args": {"add": true },
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"},
{ "key": "setting.command_mode", "operand": false }
]
},
// Commit command - Vintage mode
{ "keys": ["c", "c"], "command": "git_commit",
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"},
{ "key": "setting.command_mode", "operand": true }
]
},
{ "keys": [",", "C"], "command": "git_commit", "args": {"add": true },
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.git-status"},
{ "key": "setting.command_mode", "operand": true }
]
},
/*** GIT BLAME ***/
// Show command
{ "keys": ["enter"], "command": "git_blame_show",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-blame.line"}
]
},
// Blame command
{ "keys": ["b"], "command": "git_blame_blame",
"context": [
{ "key": "selector", "operator": "equal", "operand": "meta.git-blame.line"}
]
},
/*** GIT DIFF ***/
// Refresh
{ "keys": ["r"], "command": "git_diff_refresh",
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.git-diff"}
]
},
// Increase and decrease hunk size
{ "keys": ["+"], "command": "git_diff_change_hunk_size", "args": {"action": "increase"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.git-diff"}
]
},
{ "keys": ["-"], "command": "git_diff_change_hunk_size", "args": {"action": "decrease"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.git-diff"}
]
},
// Move commands
{ "keys": ["n"], "command": "git_diff_move", "args": {"item": "hunk", "which": "next"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.git-diff"}
]
},
{ "keys": ["N"], "command": "git_diff_move", "args": {"item": "file", "which": "next"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.git-diff"}
]
},
{ "keys": ["p"], "command": "git_diff_move", "args": {"item": "hunk", "which": "prev"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.git-diff"}
]
},
{ "keys": ["P"], "command": "git_diff_move", "args": {"item": "file", "which": "prev"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.git-diff"}
]
},
// Stage command
{ "keys": ["s"], "command": "git_diff_stage_unstage_hunk", "args": {"reverse": false},
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.git-diff"}
]
},
// Unstage command
{ "keys": ["u"], "command": "git_diff_stage_unstage_hunk", "args": {"reverse": true},
"context": [
{ "key": "selector", "operator": "equal", "operand": "source.git-diff"}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment