Skip to content

Commit 96b3cc6

Browse files
committed
eval.txt: Update Vim 8.2.4987
1 parent bce33cd commit 96b3cc6

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

en/eval.txt

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.2. Last change: 2022 Apr 17
1+
*eval.txt* For Vim version 8.2. Last change: 2022 May 13
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -523,8 +523,8 @@ only appear once. Examples: >
523523
A key is always a String. You can use a Number, it will be converted to a
524524
String automatically. Thus the String '4' and the number 4 will find the same
525525
entry. Note that the String '04' and the Number 04 are different, since the
526-
Number will be converted to the String '4'. The empty string can also be used
527-
as a key.
526+
Number will be converted to the String '4', leading zeros are dropped. The
527+
empty string can also be used as a key.
528528

529529
In |Vim9| script literaly keys can be used if the key consists of alphanumeric
530530
characters, underscore and dash, see |vim9-literal-dict|.
@@ -534,7 +534,8 @@ legacy script. This does require the key to consist only of ASCII letters,
534534
digits, '-' and '_'. Example: >
535535
:let mydict = #{zero: 0, one_key: 1, two-key: 2, 333: 3}
536536
Note that 333 here is the string "333". Empty keys are not possible with #{}.
537-
In |Vim9| script the #{} form cannot be used.
537+
In |Vim9| script the #{} form cannot be used because it can be confused with
538+
the start of a comment.
538539

539540
A value can be any expression. Using a Dictionary for a value creates a
540541
nested Dictionary: >
@@ -1533,14 +1534,22 @@ allowing the inclusion of Vim script expressions (see |expr1|). Any
15331534
expression returning a value can be enclosed between curly braces. The value
15341535
is converted to a string. All the text and results of the expressions
15351536
are concatenated to make a new string.
1536-
1537+
*E1278*
15371538
To include an opening brace '{' or closing brace '}' in the string content
1538-
double it.
1539+
double it. For double quoted strings using a backslash also works. A single
1540+
closing brace '}' will result in an error.
15391541

15401542
Examples: >
15411543
let your_name = input("What's your name? ")
1544+
< What's your name? Peter ~
1545+
>
1546+
echo
15421547
echo $"Hello, {your_name}!"
1543-
echo $"The square root of 9 is {sqrt(9)}"
1548+
< Hello, Peter! ~
1549+
>
1550+
echo $"The square root of {{9}} is {sqrt(9)}"
1551+
< The square root of {9} is 3.0 ~
1552+
15441553

15451554
option *expr-option* *E112* *E113*
15461555
------
@@ -2951,7 +2960,7 @@ the "autoload" directory in 'runtimepath'.
29512960

29522961
Using an autocommand ~
29532962

2954-
This is introduced in the user manual, section |41.14|.
2963+
This is introduced in the user manual, section |51.4|.
29552964

29562965
The autocommand is useful if you have a plugin that is a long Vim script file.
29572966
You can define the autocommand and quickly quit the script with `:finish`.
@@ -2969,7 +2978,7 @@ The file "~/vim/bufnetfuncs.vim" should then define functions that start with
29692978

29702979
Using an autoload script ~
29712980
*autoload* *E746*
2972-
This is introduced in the user manual, section |41.15|.
2981+
This is introduced in the user manual, section |51.5|.
29732982

29742983
Using a script in the "autoload" directory is simpler, but requires using
29752984
exactly the right file name. A function that can be autoloaded has a name
@@ -3252,20 +3261,20 @@ text...
32523261
{endmarker}.
32533262

32543263
If "eval" is not specified, then each line of text is
3255-
used as a |literal-string|. If "eval" is specified,
3256-
then any Vim expression in the form ``={expr}`` is
3257-
evaluated and the result replaces the expression.
3264+
used as a |literal-string|, except that single quotes
3265+
doe not need to be doubled.
3266+
If "eval" is specified, then any Vim expression in the
3267+
form {expr} is evaluated and the result replaces the
3268+
expression, like with |interp-string|.
32583269
Example where $HOME is expanded: >
32593270
let lines =<< trim eval END
32603271
some text
3261-
See the file `=$HOME`/.vimrc
3272+
See the file {$HOME}/.vimrc
32623273
more text
32633274
END
32643275
< There can be multiple Vim expressions in a single line
32653276
but an expression cannot span multiple lines. If any
32663277
expression evaluation fails, then the assignment fails.
3267-
once the "`=" has been found {expr} and a backtick
3268-
must follow. {expr} cannot be empty.
32693278

32703279
{endmarker} must not contain white space.
32713280
{endmarker} cannot start with a lower case character.
@@ -3318,10 +3327,10 @@ text...
33183327
DATA
33193328
33203329
let code =<< trim eval CODE
3321-
let v = `=10 + 20`
3322-
let h = "`=$HOME`"
3323-
let s = "`=Str1()` abc `=Str2()`"
3324-
let n = `=MyFunc(3, 4)`
3330+
let v = {10 + 20}
3331+
let h = "{$HOME}"
3332+
let s = "{Str1()} abc {Str2()}"
3333+
let n = {MyFunc(3, 4)}
33253334
CODE
33263335
<
33273336
*E121*
@@ -3537,8 +3546,8 @@ text...
35373546
:for {var} in {object} *:for* *E690* *E732*
35383547
:endfo[r] *:endfo* *:endfor*
35393548
Repeat the commands between `:for` and `:endfor` for
3540-
each item in {object}. {object} can be a |List| or
3541-
a |Blob|. *E1177*
3549+
each item in {object}. {object} can be a |List|,
3550+
a |Blob| or a |String|. *E1177*
35423551

35433552
Variable {var} is set to the value of each item.
35443553
In |Vim9| script the loop variable must not have been

0 commit comments

Comments
 (0)