Sublime Text Git Key Bindings

In recent years I’ve ended up using Sublime Text as my coding editor of choice. From time to time I go back to BBEdit, where my heart lives, or to TextMate, but something or another ends up driving me back to Sublime. A lot of the time that something is git-related. Sublime, through the SublimeGit package, has excellent git support, but, as with all things Sublime, using it requires some keyboard fu.

For example, to make a “quick commit” it’s Shift+Command+P and then typing (at least) “quick”. And then if I want to push my commits, it’s Shift+Command+P again and then “push”.

I do this hundreds of times a day, so that adds up to a lot of typing.

To reduce some of the typing, here’s what I did.

Withing Sublime Text I selected Sublime Text > Preferences > Key Bindings — User, like this:

Sublime Text Key Bindings

In the resulting (for me, empty) file called Default (OSX).sublime-keymap I entered the following key bindings setup:

  { "keys": ["f1"], "command": "git_quick_commit" },
  { "keys": ["f2"], "command": "git_push" }

With this in place, to make a quick commit I just press F1, and then to push the commit I press F2.

Thousands of keystrokes a week saved!


Add new comment