A few things to note on the new
Finally, I've been testing various methods for counting words and trying to find the best performing solution as this could become a popular tool (e.g. easily count words in the selected text).
I came up with 4 different approaches and tested them first to ensure they worked as expected: http://jsfiddle.net/alasdair/d3KGy/. Then I created a simple performance test to find the best solution and found some surprising results: http://jsperf.com/word-count-test.
Surprisingly, on Chrome at least, the approach with the most code performs best. This is best translation (I think) into CoffeeScript:
count = 0 text = text.trim() matches = text.match /\s+/g if text count++ count+= matches.length if matches count
This has been implemented by PR neocotic/template-chrome#1. One main caveat that I'll possibly fix in the future: special characters are current considered as "words". For example;