Skip to content

Commit

Permalink
Added info
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Hamiter committed May 25, 2011
1 parent b86b2d3 commit a95d352
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Sublime Text 2 Plugins
===============================================

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


blame.py
========

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


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 context (right) click.
Choose "Blame..."

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

{ "keys": ["super+shift+b"], "command": "blame" }
18 changes: 18 additions & 0 deletions blame.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os
import sublime
import sublime_plugin

class BlameCommand(sublime_plugin.TextCommand):
def run(self, edit):
if len(self.view.file_name()) > 0:
folder_name, file_name = os.path.split(self.view.file_name())
begin_line, begin_column = self.view.rowcol(self.view.sel()[0].begin())
end_line, end_column = self.view.rowcol(self.view.sel()[0].end())
begin_line = str(begin_line)
end_line = str(end_line)
lines = begin_line + ',' + end_line
self.view.window().run_command('exec', {'cmd': ['git', 'blame', '-L', lines, file_name], 'working_dir': folder_name})
sublime.status_message("git blame -L " + lines + " " + file_name)

def is_enabled(self):
return self.view.file_name() and len(self.view.file_name()) > 0

0 comments on commit a95d352

Please sign in to comment.