Mercurial > vim
comparison runtime/doc/eval.txt @ 15131:bc1a8d21c811
Update runtime files.
commit https://github.com/vim/vim/commit/d47d52232bf21036c5c89081458be7eaf2630d24
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 9 20:43:55 2018 +0100
Update runtime files.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 09 Dec 2018 20:45:05 +0100 |
parents | 3a94f7918980 |
children | 9df130fd5e0d |
comparison
equal
deleted
inserted
replaced
15130:4bd9c7284010 | 15131:bc1a8d21c811 |
---|---|
1 *eval.txt* For Vim version 8.1. Last change: 2018 May 17 | 1 *eval.txt* For Vim version 8.1. Last change: 2018 Dec 09 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
516 :for v in values(mydict) | 516 :for v in values(mydict) |
517 : echo "value: " . v | 517 : echo "value: " . v |
518 :endfor | 518 :endfor |
519 | 519 |
520 If you want both the key and the value use the |items()| function. It returns | 520 If you want both the key and the value use the |items()| function. It returns |
521 a List in which each item is a List with two items, the key and the value: > | 521 a List in which each item is a List with two items, the key and the value: > |
522 :for [key, value] in items(mydict) | 522 :for [key, value] in items(mydict) |
523 : echo key . ': ' . value | 523 : echo key . ': ' . value |
524 :endfor | 524 :endfor |
525 | 525 |
526 | 526 |
1086 | 1086 |
1087 These are INVALID: | 1087 These are INVALID: |
1088 3. empty {M} | 1088 3. empty {M} |
1089 1e40 missing .{M} | 1089 1e40 missing .{M} |
1090 | 1090 |
1091 *float-pi* *float-e* | |
1092 A few useful values to copy&paste: > | |
1093 :let pi = 3.14159265359 | |
1094 :let e = 2.71828182846 | |
1095 | |
1096 Rationale: | 1091 Rationale: |
1097 Before floating point was introduced, the text "123.456" was interpreted as | 1092 Before floating point was introduced, the text "123.456" was interpreted as |
1098 the two numbers "123" and "456", both converted to a string and concatenated, | 1093 the two numbers "123" and "456", both converted to a string and concatenated, |
1099 resulting in the string "123456". Since this was considered pointless, and we | 1094 resulting in the string "123456". Since this was considered pointless, and we |
1100 could not find it intentionally being used in Vim scripts, this backwards | 1095 could not find it intentionally being used in Vim scripts, this backwards |
1101 incompatibility was accepted in favor of being able to use the normal notation | 1096 incompatibility was accepted in favor of being able to use the normal notation |
1102 for floating point numbers. | 1097 for floating point numbers. |
1098 | |
1099 *float-pi* *float-e* | |
1100 A few useful values to copy&paste: > | |
1101 :let pi = 3.14159265359 | |
1102 :let e = 2.71828182846 | |
1103 Or, if you don't want to write them in as floating-point literals, you can | |
1104 also use functions, like the following: > | |
1105 :let pi = acos(-1.0) | |
1106 :let e = exp(1.0) | |
1103 | 1107 |
1104 *floating-point-precision* | 1108 *floating-point-precision* |
1105 The precision and range of floating points numbers depends on what "double" | 1109 The precision and range of floating points numbers depends on what "double" |
1106 means in the library Vim was compiled with. There is no way to change this at | 1110 means in the library Vim was compiled with. There is no way to change this at |
1107 runtime. | 1111 runtime. |
1436 | 1440 |
1437 Note that this means that filetype plugins don't get a different set of script | 1441 Note that this means that filetype plugins don't get a different set of script |
1438 variables for each buffer. Use local buffer variables instead |b:var|. | 1442 variables for each buffer. Use local buffer variables instead |b:var|. |
1439 | 1443 |
1440 | 1444 |
1441 Predefined Vim variables: *vim-variable* *v:var* *v:* | 1445 PREDEFINED VIM VARIABLES *vim-variable* *v:var* *v:* |
1446 *E963* | |
1447 Some variables can be set by the user, but the type cannot be changed. | |
1442 | 1448 |
1443 *v:beval_col* *beval_col-variable* | 1449 *v:beval_col* *beval_col-variable* |
1444 v:beval_col The number of the column, over which the mouse pointer is. | 1450 v:beval_col The number of the column, over which the mouse pointer is. |
1445 This is the byte index in the |v:beval_lnum| line. | 1451 This is the byte index in the |v:beval_lnum| line. |
1446 Only valid while evaluating the 'balloonexpr' option. | 1452 Only valid while evaluating the 'balloonexpr' option. |
7843 str2float({expr}) *str2float()* | 7849 str2float({expr}) *str2float()* |
7844 Convert String {expr} to a Float. This mostly works the same | 7850 Convert String {expr} to a Float. This mostly works the same |
7845 as when using a floating point number in an expression, see | 7851 as when using a floating point number in an expression, see |
7846 |floating-point-format|. But it's a bit more permissive. | 7852 |floating-point-format|. But it's a bit more permissive. |
7847 E.g., "1e40" is accepted, while in an expression you need to | 7853 E.g., "1e40" is accepted, while in an expression you need to |
7848 write "1.0e40". | 7854 write "1.0e40". The hexadecimal form "0x123" is also |
7855 accepted, but not others, like binary or octal. | |
7849 Text after the number is silently ignored. | 7856 Text after the number is silently ignored. |
7850 The decimal point is always '.', no matter what the locale is | 7857 The decimal point is always '.', no matter what the locale is |
7851 set to. A comma ends the number: "12,345.67" is converted to | 7858 set to. A comma ends the number: "12,345.67" is converted to |
7852 12.0. You can strip out thousands separators with | 7859 12.0. You can strip out thousands separators with |
7853 |substitute()|: > | 7860 |substitute()|: > |