I’m writing prose, book-length. On ST, a book project contains folders, subfolders, and text files. I’m running the WordCount package, so I can see word counts when I’m in individual files. I’d like to be able to track the running word-count total for the entire project but don’t have any ideas on how to accomplish that. Is anyone doing something similar? Any tips?
WordCount for entire project
I’m not aware offhand of a package that does something like that on a global scale, but depending on your needs probably the “easiest” route (such as it is) would be a modification to the package that you’re using in which it saves the word count for a file in a data file somewhere every time a file is saved, along with having it display that saved information in the status bar along with its current information (or maybe in lieu of it).
The general idea being that you’d have to open every file and save it once to “prime” it (or have a bit of extra code that scans all the files for you), and then as you work the totals would remain fairly consistent, so long as you don’t update files outside of Sublime.
That’s a bit hand-wavey since you’d also need to handle the situation of having multiple files open at once and make sure that things behave as expected in that case. This particular package seems to have wordcount options nine ways from sunday, which might make changes like this a bit complicated.
Thanks for your thoughts, OdatNurd. The solution you describe makes sense. I’d also thought it would work for my purposes if I could see the total project word count just occasionally on demand–i.e., not as a running tally to display but a tally I could call up with a bit of code, like a little routine that opens all the files in a given project sequentially, grabs their individual word counts, then sums those counts and spits me out a number. But that kind of thing is totally outside my league, and I should probably just keep writing instead.
If you need to count the current number of words in your project, you can use additional tools. Google Docs also doesn’t have a status bar that shows the number of words in the Google documents. However, you can click on the Tools tab in the Menu bar, under which you will find the word count option. It also allows you to choose the opportunity to show word count all the time while you’re writing your article. Unlike the word count checker tool, Google Docs only counts the number of pages, words, characters, and characters without spaces in the document. It doesn’t tell you other count metrics like word frequency or the number of sentences. So you can try https://wordcounter.ai/blog/how-many-words-in-a-paragraph, which will help you know these metrics.
Maybe just search for \w+
using Find in Files and look at the number of matches…
Sweet little solution, kingkeith. Once I clued in to the need to click the regex search button, it works like a champ. Now…I wonder if there’s the possibillity of excluding a particular folder or file from that all-files-in-project search. Most of this project contains book chapters I want to count, but I also keep a “scraps” folder in that project that really shouldn’t be part of the overall word count. Would be cool if I could exclude that from the \w+ count. But that’s a fine point. I appreciate your chiming in. THANKS!
The where
field in Find in Files
allows you to specify exclusions; if you click the ...
button to the right, there are options in there to give you the template you need.
You can use that to get it to skip files and folders.