summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-03 22:49:16 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-03 22:49:16 +0100
commited767a2073ef150971b0439a58e7ee582af6984e (patch)
treefac1ce186731fb31fc9e4e9f689b25284ca5c6c3 /runtime
parent022b896592721838e387e99fd785d3ded7b68be7 (diff)
downloadvim-git-ed767a2073ef150971b0439a58e7ee582af6984e.tar.gz
patch 7.4.1042v7.4.1042
Problem: g-CTRL-G shows the word count, but there is no way to get the word count in a script. Solution: Add the wordcount() function. (Christian Brabandt)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/editing.txt4
-rw-r--r--runtime/doc/eval.txt25
-rw-r--r--runtime/doc/usr_41.txt1
3 files changed, 28 insertions, 2 deletions
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 307e20d07..1d104bc72 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -78,7 +78,9 @@ g CTRL-G Prints the current position of the cursor in five
than one position on the screen (<Tab> or special
character), both the "real" column and the screen
column are shown, separated with a dash.
- See also 'ruler' option. {not in Vi}
+ Also see the 'ruler' option and the |wordcount()|
+ function.
+ {not in Vi}
*v_g_CTRL-G*
{Visual}g CTRL-G Similar to "g CTRL-G", but Word, Character, Line, and
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index e40116b06..10780bf64 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2016 Jan 02
+*eval.txt* For Vim version 7.4. Last change: 2016 Jan 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2075,6 +2075,7 @@ winrestcmd() String returns command to restore window sizes
winrestview( {dict}) none restore view of current window
winsaveview() Dict save view of current window
winwidth( {nr}) Number width of window {nr}
+wordcount() Dict get byte/char/word statistics
writefile( {list}, {fname} [, {flags}])
Number write list of lines to file {fname}
xor( {expr}, {expr}) Number bitwise XOR
@@ -6744,6 +6745,28 @@ winwidth({nr}) *winwidth()*
: exe "normal 50\<C-W>|"
:endif
<
+wordcount() *wordcount()*
+ The result is a dictionary of byte/chars/word statistics for
+ the current buffer. This is the same info as provided by
+ |g_CTRL-G|
+ The return value includes:
+ bytes Number of bytes in the buffer
+ chars Number of chars in the buffer
+ words Number of words in the buffer
+ cursor_bytes Number of bytes before cursor position
+ (not in Visual mode)
+ cursor_chars Number of chars before cursor position
+ (not in Visual mode)
+ cursor_words Number of words before cursor position
+ (not in Visual mode)
+ visual_bytes Number of bytes visually selected
+ (only in Visual mode)
+ visual_chars Number of chars visually selected
+ (only in Visual mode)
+ visual_words Number of chars visually selected
+ (only in Visual mode)
+
+
*writefile()*
writefile({list}, {fname} [, {flags}])
Write |List| {list} to file {fname}. Each list item is
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index eb1d5f7fb..2194dc14b 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -923,6 +923,7 @@ Various: *various-functions*
mzeval() evaluate |MzScheme| expression
py3eval() evaluate Python expression (|+python3|)
pyeval() evaluate Python expression (|+python|)
+ wordcount() get byte/word/char count of buffer
==============================================================================
*41.7* Defining a function