Sublime Forum

How to get current line number?

#1

Hi there!
I’m trying to write my first Sublime plugin so I have to get current line number in file. I couldn’t understand how to do it throw API.

Thanks in advance!

0 Likes

#2

I did it using the rowcol function on the beginning of the first selection (that is the cursor if nothing is selected

(row,col) = self.view.rowcol(self.view.sel()[0].begin())

1 Like

#3

It works! Thanks a lot!

0 Likes