How to caclulate how many words are on one line within Vim/gVim?

Go to the line you want to count and do (change the matching pattern as you want).

Up vote 2 down vote favorite 1 share g+ share fb share tw.

It is kind of hard to do it manually. It would also be nice to exclude " { } *. Essentially a word is something that begins with a letter.

And words are space separated. Vim vi link|improve this question edited Dec 24 '10 at 12:13Peter Mortensen4,36042051 asked Dec 17 '10 at 15:41vehomzzz3,44653077 92% accept rate.

Go to the line you want to count and do (change the matching pattern as you want): :s.

– vehomzzz Dec 17 '10 at 16:18 1 @vehomzzz \ Use \w\+ (or \h\+ ) instead! That's because `\ What is wrong? – khachik Dec 17 '10 at 16:37 Sorry.

I've edited my previous comment instead of adding a new one. I've found the explanation of the oddity.

Echo len(split(getline('. '), '\W\+')) " or \H if you want to ignore numbers as well The anwser is in the help: :h split().

Seems preferable to regex solution for getting result into a variable. – Herbert Sitz Dec 17 '10 at 19:01 Indeed. It depends on the objective: have a quick result for us to use, or to implement something else based on this number of words.

– Luc Hermitte Dec 17 '10 at 20:30.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions