Mercurial > vim
diff runtime/doc/eval.txt @ 7480:a49163681559 v7.4.1042
commit https://github.com/vim/vim/commit/ed767a2073ef150971b0439a58e7ee582af6984e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 3 22:49:16 2016 +0100
patch 7.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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 03 Jan 2016 23:00:04 +0100 |
parents | 05cf4cc72a9f |
children | 37e061ec063c |
line wrap: on
line diff
--- 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 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