|
1 | | -*eval.txt* For Vim version 7.4. Last change: 2015 Dec 29 |
| 1 | +*eval.txt* For Vim version 7.4. Last change: 2016 Jan 03 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -68,14 +68,16 @@ the Number. Examples: |
68 | 68 | Number 0 --> String "0" ~ |
69 | 69 | Number -1 --> String "-1" ~ |
70 | 70 | *octal* |
71 | | -Conversion from a String to a Number is done by converting the first digits |
72 | | -to a number. Hexadecimal "0xf9" and Octal "017" numbers are recognized. If |
73 | | -the String doesn't start with digits, the result is zero. Examples: |
| 71 | +Conversion from a String to a Number is done by converting the first digits to |
| 72 | +a number. Hexadecimal "0xf9", Octal "017", and Binary "0b10" numbers are |
| 73 | +recognized. If the String doesn't start with digits, the result is zero. |
| 74 | +Examples: |
74 | 75 | String "456" --> Number 456 ~ |
75 | 76 | String "6bar" --> Number 6 ~ |
76 | 77 | String "foo" --> Number 0 ~ |
77 | 78 | String "0xf1" --> Number 241 ~ |
78 | 79 | String "0100" --> Number 64 ~ |
| 80 | + String "0b101" --> Number 5 ~ |
79 | 81 | String "-8" --> Number -8 ~ |
80 | 82 | String "+8" --> Number 0 ~ |
81 | 83 |
|
@@ -2073,6 +2075,7 @@ winrestcmd() String returns command to restore window sizes |
2073 | 2075 | winrestview( {dict}) none restore view of current window |
2074 | 2076 | winsaveview() Dict save view of current window |
2075 | 2077 | winwidth( {nr}) Number width of window {nr} |
| 2078 | +wordcount() Dict get byte/char/word statistics |
2076 | 2079 | writefile( {list}, {fname} [, {flags}]) |
2077 | 2080 | Number write list of lines to file {fname} |
2078 | 2081 | xor( {expr}, {expr}) Number bitwise XOR |
@@ -5955,12 +5958,14 @@ str2float( {expr}) *str2float()* |
5955 | 5958 |
|
5956 | 5959 | str2nr( {expr} [, {base}]) *str2nr()* |
5957 | 5960 | Convert string {expr} to a number. |
5958 | | - {base} is the conversion base, it can be 8, 10 or 16. |
| 5961 | + {base} is the conversion base, it can be 2, 8, 10 or 16. |
5959 | 5962 | When {base} is omitted base 10 is used. This also means that |
5960 | 5963 | a leading zero doesn't cause octal conversion to be used, as |
5961 | 5964 | with the default String to Number conversion. |
5962 | 5965 | When {base} is 16 a leading "0x" or "0X" is ignored. With a |
5963 | | - different base the result will be zero. |
| 5966 | + different base the result will be zero. Similarly, when |
| 5967 | + {base} is 8 a leading "0" is ignored, and when {base} is 2 a |
| 5968 | + leading "0b" or "0B" is ignored. |
5964 | 5969 | Text after the number is silently ignored. |
5965 | 5970 |
|
5966 | 5971 |
|
@@ -6740,6 +6745,28 @@ winwidth({nr}) *winwidth()* |
6740 | 6745 | : exe "normal 50\<C-W>|" |
6741 | 6746 | :endif |
6742 | 6747 | < |
| 6748 | +wordcount() *wordcount()* |
| 6749 | + The result is a dictionary of byte/chars/word statistics for |
| 6750 | + the current buffer. This is the same info as provided by |
| 6751 | + |g_CTRL-G| |
| 6752 | + The return value includes: |
| 6753 | + bytes Number of bytes in the buffer |
| 6754 | + chars Number of chars in the buffer |
| 6755 | + words Number of words in the buffer |
| 6756 | + cursor_bytes Number of bytes before cursor position |
| 6757 | + (not in Visual mode) |
| 6758 | + cursor_chars Number of chars before cursor position |
| 6759 | + (not in Visual mode) |
| 6760 | + cursor_words Number of words before cursor position |
| 6761 | + (not in Visual mode) |
| 6762 | + visual_bytes Number of bytes visually selected |
| 6763 | + (only in Visual mode) |
| 6764 | + visual_chars Number of chars visually selected |
| 6765 | + (only in Visual mode) |
| 6766 | + visual_words Number of chars visually selected |
| 6767 | + (only in Visual mode) |
| 6768 | + |
| 6769 | + |
6743 | 6770 | *writefile()* |
6744 | 6771 | writefile({list}, {fname} [, {flags}]) |
6745 | 6772 | Write |List| {list} to file {fname}. Each list item is |
|
0 commit comments