python - Get current line in Sublime Text 3 plugin -


i'm writing simple plugin sublime text 3 , need contents of selected line. can use

selection = sublime.region(self.view.sel()[0].begin(), self.view.sel()[0].end()) 

to highlighted section, there way select or return contents of entire current line without manually selecting of it?

the 'duplicate' example on this page want, seems broken in st3. when run error typeerror: run() missing 1 required positional argument: 'args'.

i believe you're after view.substr(view.line(view.sel()[0]))

this return text of current line.


Comments