Ag. D Hatzimanikas wrote:
> Please issue,
>
> :helpgrep Wordcount
>
>
> let count = count + Wordcount(getline(n))
>
> The Wordcount function does not exists.
>
>
> Again from the same function, the "count" variable is a read only, so it
> has to be preceded with an "l:". Funny thing is that the "count" var is
> being mentioned for this same reason in,
>
> :h l:var
>
> The attached patch fixes both issues.
> The implementation however to replace the Wordcount function its up to
> you to decide. From my tests returns the same number of words with
> g <CTRL-G>.
I think this is a slightly better solution:
:function Count_words() range
: let lnum = a:firstline
: let n = 0
: while lnum <= a:lastline
: let n = n + len(split(getline(lnum)))
: let lnum = lnum + 1
: endwhile
: echo "found " . n . " words"
:endfunction
It counts white space separated words, but that shouldn't matter in this
context.
> And since we are talking about documentation another minor thing in,
>
> :h libcall()
>
> the last example refers to the next function libcallnr().
I'll move it to there.
--
Trees moving back and forth is what makes the wind blow.
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---