/sublime-git

sublime git commands

Primary LanguagePython

Sublime Text 2 Plugins

This is just a handy place to store some plugins I wrote for ST2.

blame.py

blame.py is a Git blame plugin. It takes selected lines as arguments and outputs the data into the console.

blame screenshot

Installation

Copy blame.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)

Usage

Select text or click desired line(s), then activate.

I've added this to my User Key Bindings (Command-Shift-B on a Mac):

{ "keys": ["super+alt+b"], "command": "blame" }

...and this in User/Default_(your OS)_Context.sublime-menu, which allows context menu access:

{ "command": "blame", "caption": "Blame…" }

googleIt.py

googleIt.py is a Google looker-upper. It takes the scope of the file and appends it to a Google search of either the word under the cursor or the selected text.

googleIt screenshot

Installation

Copy googleIt.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)

Usage

Select text or click desired word, then activate.

I've added this to my User Key Bindings (Control-Alt-/ on a Mac):

{ "keys": ["ctrl+alt+forward_slash"], "command": "google_it" }

...and this in User/Default_(your OS)_Context.sublime-menu, which allows context menu access:

{ "command": "googleIt", "caption": "googleIt…" }

pep8check.py

pep8check.py is a PEP 8 style guide plugin. It uses another Python program called pep8.py. It looks like this:

blame screenshot

Installation

Copy pep8check.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)

Take a look through the code, and add or remove options that fit your needs. In the stock example, I have the following set up:

--repeat          show all occurrences of the same error
--verbose         print status messages, or debug with -vv
--repeat          show all occurrences of the same error
--ignore=errors   skip errors and warnings (e.g. E4,W)
--show-source     show source code for each error
--statistics      count errors and warnings
--count           print total number of errors and warnings to standard error and set exit code to 1 if total is not null

Play around with the options until you get what you want.

This plugin is dependent on pep8, which you must install yourself. You can install, upgrade, uninstall pep8.py with these commands:

$ sudo pip install pep8
$ sudo pip install --upgrade pep8
$ sudo pip uninstall pep8

Or if you don't have pip:

$ sudo easy_install pep8

There's also a package for Debian/Ubuntu, but it's not always the latest version:

$ sudo apt-get install pep8

Usage

I've added this to my User Key Bindings (Command-Shift-8 on a Mac):

{ "keys": ["super+shift+8"], "command": "pep8_check" }

...and this in User/Default_(your OS)_Context.sublime-menu, which allows context menu access:

{ "command": "pep8_check", "caption": "PEP8 Check…" }