I have tried many things, but none of them worked.
Expected result: I type a shortkey, and git gui blame opens the current file at the line the pointer is on.
I work on Windows 7, with Sublime 3 Build 3083
First try : Custom Build System
{ "cmd": [ "C:\\Program Files (x86)\\Git\\cmd\\git.exe" "gui" "blame" "$file"] }
In a file named git_gui_blame.sublime-build
Then Tools -> Build System -> git_gui_blame. But then Ctrl+B only makes "no build system" appear
Second try : Custom key binding
Preference -> Key Bindings - User
{ "keys": ["ctrl+B"],
"command": "exec",
"args": {
"cmd": [
"C:\\Program Files (x86)\\Git\\cmd\\git.exe",
"gui",
"blame",
?//What to put here ?
]
}
},
I tried replacing "?" with "$file", inspired from the $file of the build system, but I got this error
which can be translated by "Incorrect file path : /path/to/$file : Inexistant file or repertory
Third try : Custom Plugin
import sublime, sublime_plugin, os
class SublimeBlameCommand(sublime_plugin.WindowCommand):
def run(self, **kwargs):
folder_name, file_name = os.path.split(self.window.active_view().file_name())
print(folder_name + " _______ " + file_name)
try:
self.window.active_view().run_command('exec', {'cmd': ['C:\\Program Files (x86)\\Git\\cmd\\git.exe', 'gui', 'blame', file_name], 'working_dir':folder_name, 'shell':False} )
except TypeError:
print("Error in SublimeBlame Plugin")
and after that, in Preferences -> Key Bindings - User
{ "keys": ["ctrl+k"],
"command": "sublime_blame"
},
But Ctrl+k does absolutely nothing.
So I'm stuck here. What can I do differently ? My prefered try is the second because I feel I got the closest to the expected result, but I couldn't find what to replace the "?" with.