I’m wanting to pass the current line number as an argument in a plugin script. Like so:
[code]import sublime_plugin
import sublime
import os
class BlameCommand(sublime_plugin.TextCommand):
def run(self, edit):
if len(self.view.file_name()) > 0:
lines = self.view.rowcol(self.view.sel()[0].begin()) ## <- this does not work
folder_name, file_name = os.path.split(self.view.file_name())
self.view.window().run_command('exec', {'cmd': 'git', 'blame', '-L', lines, file_name], 'working_dir': folder_name})
sublime.status_message("line: " + lines + " git blame " + file_name)
def is_enabled(self):
return self.view.file_name() and len(self.view.file_name()) > 0[/code]
I can manually change “lines” to something like “15,20” and it will return lines 15-20. I’d like to set lines to either the current line, or the selected lines. Any tips?