Skip to content

Commit f9962e2

Browse files
committed
eval.txt: Update Vim 8.2.5126
1 parent 9d459a5 commit f9962e2

File tree

1 file changed

+97
-72
lines changed

1 file changed

+97
-72
lines changed

en/eval.txt

Lines changed: 97 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.2. Last change: 2022 May 13
1+
*eval.txt* For Vim version 8.2. Last change: 2022 Jun 03
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -183,10 +183,15 @@ You will not get an error if you try to change the type of a variable.
183183
1.2 Function references ~
184184
*Funcref* *E695* *E718* *E1192*
185185
A Funcref variable is obtained with the |function()| function, the |funcref()|
186-
function or created with the lambda expression |expr-lambda|. It can be used
187-
in an expression in the place of a function name, before the parenthesis
188-
around the arguments, to invoke the function it refers to. Example: >
186+
function, (in |Vim9| script) the name of a function, or created with the
187+
lambda expression |expr-lambda|. It can be used in an expression in the place
188+
of a function name, before the parenthesis around the arguments, to invoke the
189+
function it refers to. Example in |Vim9| script: >
189190
191+
:var Fn = MyFunc
192+
:echo Fn()
193+
194+
Legacy script: >
190195
:let Fn = function("MyFunc")
191196
:echo Fn()
192197
< *E704* *E705* *E707*
@@ -526,7 +531,7 @@ entry. Note that the String '04' and the Number 04 are different, since the
526531
Number will be converted to the String '4', leading zeros are dropped. The
527532
empty string can also be used as a key.
528533

529-
In |Vim9| script literaly keys can be used if the key consists of alphanumeric
534+
In |Vim9| script literally keys can be used if the key consists of alphanumeric
530535
characters, underscore and dash, see |vim9-literal-dict|.
531536
*literal-Dict* *#{}*
532537
To avoid having to put quotes around every key the #{} form can be used in
@@ -868,33 +873,36 @@ Expression syntax summary, from least to most significant:
868873
expr5 isnot expr5 different |List|, |Dictionary| or |Blob|
869874
instance
870875

871-
|expr5| expr6
872-
expr6 + expr6 ... number addition, list or blob concatenation
873-
expr6 - expr6 ... number subtraction
874-
expr6 . expr6 ... string concatenation
875-
expr6 .. expr6 ... string concatenation
876+
|expr5| expr6 << expr6 bitwise left shift
877+
expr6 >> expr6 bitwise right shift
876878

877879
|expr6| expr7
878-
expr7 * expr7 ... number multiplication
879-
expr7 / expr7 ... number division
880-
expr7 % expr7 ... number modulo
880+
expr7 + expr7 ... number addition, list or blob concatenation
881+
expr7 - expr7 ... number subtraction
882+
expr7 . expr7 ... string concatenation
883+
expr7 .. expr7 ... string concatenation
881884

882885
|expr7| expr8
883-
<type>expr8 type check and conversion (|Vim9| only)
886+
expr8 * expr8 ... number multiplication
887+
expr8 / expr8 ... number division
888+
expr8 % expr8 ... number modulo
884889

885890
|expr8| expr9
886-
! expr8 logical NOT
887-
- expr8 unary minus
888-
+ expr8 unary plus
891+
<type>expr9 type check and conversion (|Vim9| only)
889892

890893
|expr9| expr10
891-
expr9[expr1] byte of a String or item of a |List|
892-
expr9[expr1 : expr1] substring of a String or sublist of a |List|
893-
expr9.name entry in a |Dictionary|
894-
expr9(expr1, ...) function call with |Funcref| variable
895-
expr9->name(expr1, ...) |method| call
896-
897-
|expr10| number number constant
894+
! expr9 logical NOT
895+
- expr9 unary minus
896+
+ expr9 unary plus
897+
898+
|expr10| expr11
899+
expr10[expr1] byte of a String or item of a |List|
900+
expr10[expr1 : expr1] substring of a String or sublist of a |List|
901+
expr10.name entry in a |Dictionary|
902+
expr10(expr1, ...) function call with |Funcref| variable
903+
expr10->name(expr1, ...) |method| call
904+
905+
|expr11| number number constant
898906
"string" string constant, backslash is special
899907
'string' string constant, ' is doubled
900908
[expr1, ...] |List|
@@ -1128,14 +1136,27 @@ can be matched like an ordinary character. Examples:
11281136
"foo\nbar" =~ "\\n" evaluates to 0
11291137

11301138

1131-
expr5 and expr6 *expr5* *expr6* *E1036* *E1051*
1139+
expr5 *expr5* *bitwise-shift*
1140+
-----
1141+
expr6 << expr6 bitwise left shift *expr-<<*
1142+
expr6 >> expr6 bitwise right shift *expr->>*
1143+
*E1282* *E1283*
1144+
The "<<" and ">>" operators can be used to perform bitwise left or right shift
1145+
of the left operand by the number of bits specified by the right operand. The
1146+
operands are used as positive numbers. When shifting right with ">>" the
1147+
topmost bit (sometimes called the sign bit) is cleared. If the right operand
1148+
(shift amount) is more than the maximum number of bits in a number
1149+
(|v:numbersize|) the result is zero.
1150+
1151+
1152+
expr6 and expr7 *expr6* *expr7* *E1036* *E1051*
11321153
---------------
1133-
expr6 + expr6 Number addition, |List| or |Blob| concatenation *expr-+*
1134-
expr6 - expr6 Number subtraction *expr--*
1135-
expr6 . expr6 String concatenation *expr-.*
1136-
expr6 .. expr6 String concatenation *expr-..*
1154+
expr7 + expr7 Number addition, |List| or |Blob| concatenation *expr-+*
1155+
expr7 - expr7 Number subtraction *expr--*
1156+
expr7 . expr7 String concatenation *expr-.*
1157+
expr7 .. expr7 String concatenation *expr-..*
11371158

1138-
For |Lists| only "+" is possible and then both expr6 must be a list. The
1159+
For |Lists| only "+" is possible and then both expr7 must be a list. The
11391160
result is a new list with the two lists Concatenated.
11401161

11411162
For String concatenation ".." is preferred, since "." is ambiguous, it is also
@@ -1147,9 +1168,9 @@ In |Vim9| script the arguments of ".." are converted to String for simple
11471168
types: Number, Float, Special and Bool. For other types |string()| should be
11481169
used.
11491170

1150-
expr7 * expr7 Number multiplication *expr-star*
1151-
expr7 / expr7 Number division *expr-/*
1152-
expr7 % expr7 Number modulo *expr-%*
1171+
expr8 * expr8 Number multiplication *expr-star*
1172+
expr8 / expr8 Number division *expr-/*
1173+
expr8 % expr8 Number modulo *expr-%*
11531174

11541175
In legacy script, for all operators except "." and "..", Strings are converted
11551176
to Numbers.
@@ -1191,18 +1212,18 @@ None of these work for |Funcref|s.
11911212
".", ".." and "%" do not work for Float. *E804* *E1035*
11921213

11931214

1194-
expr7 *expr7*
1215+
expr8 *expr8*
11951216
-----
1196-
<type>expr8
1217+
<type>expr9
11971218

11981219
This is only available in |Vim9| script, see |type-casting|.
11991220

12001221

1201-
expr8 *expr8*
1222+
expr9 *expr9*
12021223
-----
1203-
! expr8 logical NOT *expr-!*
1204-
- expr8 unary minus *expr-unary--*
1205-
+ expr8 unary plus *expr-unary-+*
1224+
! expr9 logical NOT *expr-!*
1225+
- expr9 unary minus *expr-unary--*
1226+
+ expr9 unary plus *expr-unary-+*
12061227

12071228
For '!' |TRUE| becomes |FALSE|, |FALSE| becomes |TRUE| (one).
12081229
For '-' the sign of the number is changed.
@@ -1224,30 +1245,30 @@ These three can be repeated and mixed. Examples:
12241245
--9 == 9
12251246

12261247

1227-
expr9 *expr9*
1228-
-----
1229-
This expression is either |expr10| or a sequence of the alternatives below,
1248+
expr10 *expr10*
1249+
------
1250+
This expression is either |expr11| or a sequence of the alternatives below,
12301251
in any order. E.g., these are all possible:
1231-
expr9[expr1].name
1232-
expr9.name[expr1]
1233-
expr9(expr1, ...)[expr1].name
1234-
expr9->(expr1, ...)[expr1]
1252+
expr10[expr1].name
1253+
expr10.name[expr1]
1254+
expr10(expr1, ...)[expr1].name
1255+
expr10->(expr1, ...)[expr1]
12351256
Evaluation is always from left to right.
12361257

1237-
expr9[expr1] item of String or |List| *expr-[]* *E111*
1258+
expr10[expr1] item of String or |List| *expr-[]* *E111*
12381259
*E909* *subscript* *E1062*
12391260
In legacy Vim script:
1240-
If expr9 is a Number or String this results in a String that contains the
1241-
expr1'th single byte from expr9. expr9 is used as a String (a number is
1261+
If expr10 is a Number or String this results in a String that contains the
1262+
expr1'th single byte from expr10. expr10 is used as a String (a number is
12421263
automatically converted to a String), expr1 as a Number. This doesn't
12431264
recognize multibyte encodings, see `byteidx()` for an alternative, or use
12441265
`split()` to turn the string into a list of characters. Example, to get the
12451266
byte under the cursor: >
12461267
:let c = getline(".")[col(".") - 1]
12471268
12481269
In |Vim9| script: *E1147* *E1148*
1249-
If expr9 is a String this results in a String that contains the expr1'th
1250-
single character (including any composing characters) from expr9. To use byte
1270+
If expr10 is a String this results in a String that contains the expr1'th
1271+
single character (including any composing characters) from expr10. To use byte
12511272
indexes use |strpart()|.
12521273

12531274
Index zero gives the first byte or character. Careful: text column numbers
@@ -1258,7 +1279,7 @@ String. A negative index always results in an empty string (reason: backward
12581279
compatibility). Use [-1:] to get the last byte or character.
12591280
In Vim9 script a negative index is used like with a list: count from the end.
12601281

1261-
If expr9 is a |List| then it results the item at index expr1. See |list-index|
1282+
If expr10 is a |List| then it results the item at index expr1. See |list-index|
12621283
for possible index values. If the index is out of range this results in an
12631284
error. Example: >
12641285
:let item = mylist[-1] " get last item
@@ -1268,14 +1289,14 @@ Generally, if a |List| index is equal to or higher than the length of the
12681289
error.
12691290

12701291

1271-
expr9[expr1a : expr1b] substring or sublist *expr-[:]*
1292+
expr10[expr1a : expr1b] substring or sublist *expr-[:]*
12721293

1273-
If expr9 is a String this results in the substring with the bytes or
1274-
characters from expr1a to and including expr1b. expr9 is used as a String,
1294+
If expr10 is a String this results in the substring with the bytes or
1295+
characters from expr1a to and including expr1b. expr10 is used as a String,
12751296
expr1a and expr1b are used as a Number.
12761297

12771298
In legacy Vim script the indexes are byte indexes. This doesn't recognize
1278-
multibyte encodings, see |byteidx()| for computing the indexes. If expr9 is
1299+
multibyte encodings, see |byteidx()| for computing the indexes. If expr10 is
12791300
a Number it is first converted to a String.
12801301

12811302
In Vim9 script the indexes are character indexes and include composing
@@ -1302,20 +1323,20 @@ Examples: >
13021323
:let s = s[:-3] " remove last two bytes
13031324
<
13041325
*slice*
1305-
If expr9 is a |List| this results in a new |List| with the items indicated by
1326+
If expr10 is a |List| this results in a new |List| with the items indicated by
13061327
the indexes expr1a and expr1b. This works like with a String, as explained
13071328
just above. Also see |sublist| below. Examples: >
13081329
:let l = mylist[:3] " first four items
13091330
:let l = mylist[4:4] " List with one item
13101331
:let l = mylist[:] " shallow copy of a List
13111332
1312-
If expr9 is a |Blob| this results in a new |Blob| with the bytes in the
1333+
If expr10 is a |Blob| this results in a new |Blob| with the bytes in the
13131334
indexes expr1a and expr1b, inclusive. Examples: >
13141335
:let b = 0zDEADBEEF
13151336
:let bs = b[1:2] " 0zADBE
13161337
:let bs = b[:] " copy of 0zDEADBEEF
13171338
1318-
Using expr9[expr1] or expr9[expr1a : expr1b] on a |Funcref| results in an
1339+
Using expr10[expr1] or expr10[expr1a : expr1b] on a |Funcref| results in an
13191340
error.
13201341

13211342
Watch out for confusion between a namespace and a variable followed by a colon
@@ -1324,11 +1345,11 @@ for a sublist: >
13241345
mylist[s:] " uses namespace s:, error!
13251346
13261347
1327-
expr9.name entry in a |Dictionary| *expr-entry*
1348+
expr10.name entry in a |Dictionary| *expr-entry*
13281349
*E1203* *E1229*
1329-
If expr9 is a |Dictionary| and it is followed by a dot, then the following
1350+
If expr10 is a |Dictionary| and it is followed by a dot, then the following
13301351
name will be used as a key in the |Dictionary|. This is just like:
1331-
expr9[name].
1352+
expr10[name].
13321353

13331354
The name must consist of alphanumeric characters, just like a variable name,
13341355
but it may start with a number. Curly braces cannot be used.
@@ -1345,17 +1366,17 @@ Note that the dot is also used for String concatenation. To avoid confusion
13451366
always put spaces around the dot for String concatenation.
13461367

13471368

1348-
expr9(expr1, ...) |Funcref| function call *E1085*
1369+
expr10(expr1, ...) |Funcref| function call *E1085*
13491370

1350-
When expr9 is a |Funcref| type variable, invoke the function it refers to.
1371+
When expr10 is a |Funcref| type variable, invoke the function it refers to.
13511372

13521373

1353-
expr9->name([args]) method call *method* *->*
1354-
expr9->{lambda}([args])
1374+
expr10->name([args]) method call *method* *->*
1375+
expr10->{lambda}([args])
13551376
*E260* *E276* *E1265*
13561377
For methods that are also available as global functions this is the same as: >
1357-
name(expr9 [, args])
1358-
There can also be methods specifically for the type of "expr9".
1378+
name(expr10 [, args])
1379+
There can also be methods specifically for the type of "expr10".
13591380

13601381
This allows for chaining, passing the value that one method returns to the
13611382
next method: >
@@ -1364,7 +1385,7 @@ next method: >
13641385
Example of using a lambda: >
13651386
GetPercentage()->{x -> x * 100}()->printf('%d%%')
13661387
<
1367-
When using -> the |expr8| operators will be applied first, thus: >
1388+
When using -> the |expr9| operators will be applied first, thus: >
13681389
-1.234->string()
13691390
Is equivalent to: >
13701391
(-1.234)->string()
@@ -1393,7 +1414,7 @@ When using the lambda form there must be no white space between the } and the
13931414
(.
13941415

13951416

1396-
*expr10*
1417+
*expr11*
13971418
number
13981419
------
13991420
number number constant *expr-number*
@@ -1402,6 +1423,10 @@ number number constant *expr-number*
14021423
Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B)
14031424
and Octal (starting with 0, 0o or 0O).
14041425

1426+
Assuming 64 bit numbers are used (see |v:numbersize|) an unsigned number is
1427+
truncated to 0x7fffffffffffffff or 9223372036854775807. You can use -1 to get
1428+
0xffffffffffffffff.
1429+
14051430
*floating-point-format*
14061431
Floating point numbers can be written in two forms:
14071432

@@ -1524,7 +1549,7 @@ to be doubled. These two commands are equivalent: >
15241549
if a =~ '\s*'
15251550
15261551
1527-
interpolated-string *interp-string* *E256*
1552+
interpolated-string *$quote* *interp-string* *E256*
15281553
--------------------
15291554
$"string" interpolated string constant *expr-$quote*
15301555
$'string' interpolated literal string constant *expr-$'*
@@ -2978,7 +3003,7 @@ The file "~/vim/bufnetfuncs.vim" should then define functions that start with
29783003

29793004
Using an autoload script ~
29803005
*autoload* *E746*
2981-
This is introduced in the user manual, section |51.5|.
3006+
This is introduced in the user manual, section |52.2|.
29823007

29833008
Using a script in the "autoload" directory is simpler, but requires using
29843009
exactly the right file name. A function that can be autoloaded has a name

0 commit comments

Comments
 (0)