Hi,
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>.
And since we are talking about documentation another minor thing in,
:h libcall()
the last example refers to the next function libcallnr().
Regards,
Ag.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---
--- doc/usr_41.txt.orig 2008-05-02 23:13:39.580705720 +0300
+++ doc/usr_41.txt 2008-05-02 23:17:26.155476799 +0300
@@ -951,12 +951,12 @@
:function Count_words() range
: let n = a:firstline
- : let count = 0
+ : let l:count = 0
: while n <= a:lastline
- : let count = count + Wordcount(getline(n))
+ : let l:count = l:count + len(split(getline(n), ''))
: let n = n + 1
: endwhile
- : echo "found " . count . " words"
+ : echo "found " . l:count . " words"
:endfunction
You can call this function with: >