If you want to keep track of the size of your writeup and the amount you’ve written inside a Text editor, where do you first get your sight caught at? Easy – it’s the word count! Text editors typically have a status line on the bottom where it shows the number of words, characters, and sometimes even the number paragraphs that you have in the file that’s currently open in the editor.
For writers, keeping track of the word count is essential. However, if you’re a coder and don’t bother about how many words your code file has, you could still make good use of this information to some degree, such as keeping track of your file’s visible magnitude. Nevertheless, if you’ve just installed the Sublime Text editor and started using it, you’d probably have noticed by now that there is no word count viewed on the bottom of the editor.
That’s why, this article aims to guide you through the process of viewing the word count in Sublime Text.
Why does Sublime Text not show word count?
As I’m not a developer of Sublime Text myself, I’d not be able to give you the exact reasoning behind why Sublime Text doesn’t show any word count by default. But if you put into it some logic, you’d be not far from the understanding that as it is solely a text editor, and not a document writing tool like Microsoft Word, it does not necessarily need to show the word count as code files barely have much to do with the word count. Typically, what coders are concerned about a given file is its line number and the column number, which of course is shown at the bottom left of the editor window in Sublime Text.
Certain sources claim that if you select some text in the editor, the word count under the selected portion of text will be shown at the bottom left of the editor windows, but be warned – it is not actually true. The only information you’ll see at the bottom left of the screen once you select some text is the number of characters and lines – no word count in any form.
The following sections will discuss the possible ways of viewing the word count in Sublime Text, or to the very least, figure out the number of words present indirectly.
Use a regular expression with ‘find’
This is not exactly a full proof solution to viewing word count in Sublime Text. But if you don’t want to fiddle with any external packages for Sublime text, this is the only solution you have, as there is no option or setting in the entire program which lets you view the word count whatsoever. So what’s the solution that I’m really talking about?
If you pair up the regular find function in Sublime Text with a regular expression that searches for words, you can indirectly count out the number of words, by looking at the number of matches found. Can’t wrap it up round your head? Let me explain.
Take the following situation as an example:
This is surely some serious amount of text (I wonder how painful counting each of them one by one would be – nobody would ever wish to do that). Now what you could do is fire up a program that has a word counter and paste all this text in there. But how tedious would that be, right? Luckily, we have a quick trick, to at least easen things up.
FIrst, what I’d do is press Ctrl + F (or Command + F in Mac) to turn the find function on:
Now on the bottom left corner of the screen, I’d like to press the [.*] button, which enables the Regular Expression search:
Next up, inside the input box, type in:
Whether or not you’ve noticed it by now (looking at the circular blue marks on each word), what this does is select every expression of a word in the entire file, and marks it as a match. If you further look at the bottom left of the editor window in the above screenshot, you should see the text “1 of 332 matches”
The 332 matches tells us the number of words in our file, which is 332 words. If you’re worried about it’s accuracy, here’s a screenshot from an online word counter where I pasted the entire text:
Use a plugin to display the word count
If you don’t like the previously mentioned method, and would like to view the word count any time you want without needing to do anything extra, you can install an external package (in other words, a plugin). There are a couple of packages that do the job, but for now, the WordingStatus package alone should be enough.
First, fire up the Command Palette in Sublime text by pressing Ctrl + Shift + P (or Command + Shift + P in Mac), type in “Install package Control” and then press Enter:
This will install the Package Control utility which allows you to install external packages. Fire up the command palette once again, and this time around, type in “Install Package” and press Enter:
Give it some time to load the repositories. Once done, you can now search for WordingStatus, and then press Enter once again to install the package:
Once the package is installed, you should now be shown the word count with a few other information at the bottom left of the screen:
As expected, it is 332 words.