Home Download Buy Blog Forum Support

How to get current line number?

How to get current line number?

Postby amaslenn on Thu Feb 02, 2012 6:39 pm

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!
amaslenn
 
Posts: 3
Joined: Thu Feb 02, 2012 6:37 pm

Re: How to get current line number?

Postby Clams on Thu Feb 02, 2012 6:55 pm

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())
Clams
 
Posts: 47
Joined: Fri Dec 30, 2011 7:44 am

Re: How to get current line number?

Postby amaslenn on Thu Feb 02, 2012 7:03 pm

It works! Thanks a lot!
amaslenn
 
Posts: 3
Joined: Thu Feb 02, 2012 6:37 pm


Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests