This allows you to simply select the lines and press CMD+L
to see the diff. Create a file named git-log.py
in your Sublime Packages/User
directory with:
import sublime
import sublime_plugin
class GitLogLineCommand(sublime_plugin.WindowCommand):
def run(self, reverse=False):
view = self.window.active_view()
sel = view.sel()[0]
line_begin = view.rowcol(sel.begin())[0]
line_end = view.rowcol(sel.end())[0]
file = view.file_name()
view.window().run_command('git_raw', {'command': 'git log -L %d,%d:%s' % (line_begin, line_end, file)})
Add in your sublime-keymap
[
{ "keys": ["super+l"], "command": "git_log_line" }
]
This requires the Git plugin to be installed.