Home Download Buy Blog Forum Support

Count lines in a project

Count lines in a project

Postby DannyBen on Sat Jul 21, 2012 9:18 am

Hello everybody,

Does anyone know if there is a way (or a plugin) to count the total number of lines in a project?
I would imagine such a plugin should have some configuration file to set which extensions to scan (e.g. .php, .css) and which folders to ignore (e.g. /ExternalLibraries)
DannyBen
 
Posts: 4
Joined: Mon Jul 16, 2012 8:16 pm

Re: Count lines in a project

Postby jeroenvisser101 on Mon Jul 30, 2012 10:14 pm

Hey,

I don't know any plugins that do it. I know you can do it very easily by using a regex search:

Menu > Find > Find in files...

Then turn on regular expression search (regex) and use the following values:
Find:
Code: Select all
^(.*)$

Where:
Code: Select all
/Your/Project/Directory,*.less,*.js,*.php


Remember to NOT click on the Replace button, as it removes all lines. :oops:

Then press search. If you scroll to the bottom, you get something like "30036 matches across 282 files" That means, 30036 lines in 282 code files.

Cheers,

Jeroen Visser
jeroenvisser101
 
Posts: 1
Joined: Mon Jul 30, 2012 10:08 pm

Re: Count lines in a project

Postby proSoHard on Fri Apr 05, 2013 5:34 am

Thank you, it's helpful :idea:
proSoHard
 
Posts: 2
Joined: Wed Mar 06, 2013 4:15 am

Re: Count lines in a project

Postby teaman on Fri Mar 07, 2014 7:03 pm

How would you modify this search string to exclude blank lines or even "white space" lines that have tabs or spaces but not text?
teaman
 
Posts: 3
Joined: Thu Feb 28, 2013 7:47 pm

Re: Count lines in a project

Postby frou on Sat Mar 08, 2014 8:06 pm

teaman wrote:How would you modify this search string to exclude blank lines or even "white space" lines that have tabs or spaces but not text?

I would just install cloc rather than trying to jerry-rig something in Sublime: http://cloc.sourceforge.net
frou
 
Posts: 49
Joined: Sun Jul 31, 2011 11:26 am


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 18 guests

cron