Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Count total code lines in project using Sublime texteditor
// Go to menue:
// find->find in files
// Switch on reg_ex button
// Find:
^(.*)$
// Where:
c:\your_folder\,*.php,*.phtml,*.js,*.inc,*.html, -*/folder_to_exclude/*
// Then click on the find button
// Be careful to not click on Replace!!!
// On the bottom line of your search result you'll find something like:
// 21342 matches in 124 files = your lines of code
@halcarleton

This comment has been minimized.

Copy link

commented Mar 21, 2014

Wouldn't this include lines that contain only white space?

I use the regex:
^.*\S+.*$

This makes sure there are characters other than white space in each the line, but they can still start and end with white space.

Nice Gist though, I'll be forking it. Thanks!

@Pushplaybang

This comment has been minimized.

Copy link

commented Aug 10, 2014

nice one.

@tim-peterson

This comment has been minimized.

Copy link

commented Oct 2, 2014

Can't get this snippet to not give me the beachball of death and I have a brand new Mac. I'm an intermediate sublime user, so gotta be doing something wrong.

Screenshot of my settings...
http://imgur.com/ILZuvDf

@Hexodus

This comment has been minimized.

Copy link
Owner Author

commented Mar 12, 2016

@halleycarleton Thanks for sharing. This is indeed a better regex but I like it to look bigger then it is ;)
@tim-peterson Sorry, I do not have a mac so I'm very sorry but I can't help.

@ElectricRCAircraftGuy

This comment has been minimized.

Copy link

commented Jan 14, 2018

@jajhonrod1620

This comment has been minimized.

Copy link

commented May 25, 2018

Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.