Skip to content

Commit 3bd575d

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 219aa9f + db77c49 commit 3bd575d

25 files changed

Lines changed: 194 additions & 110 deletions

runtime/doc/builtin.txt

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5107,7 +5107,7 @@ len({expr}) The result is a Number, which is the length of the argument.
51075107
When {expr} is a |Blob| the number of bytes is returned.
51085108
When {expr} is a |Dictionary| the number of entries in the
51095109
|Dictionary| is returned.
5110-
Otherwise an error is given.
5110+
Otherwise an error is given and returns zero.
51115111

51125112
Can also be used as a |method|: >
51135113
mylist->len()
@@ -5200,6 +5200,7 @@ line({expr} [, {winid}]) *line()*
52005200
|getpos()|.
52015201
With the optional {winid} argument the values are obtained for
52025202
that window instead of the current window.
5203+
Returns 0 for invalid values of {expr} and {winid}.
52035204
Examples: >
52045205
line(".") line number of the cursor
52055206
line(".", winid) idem, in window "winid"
@@ -5267,6 +5268,8 @@ list2str({list} [, {utf8}]) *list2str()*
52675268
With UTF-8 composing characters work as expected: >
52685269
list2str([97, 769]) returns "á"
52695270
<
5271+
Returns an empty string on error.
5272+
52705273
Can also be used as a |method|: >
52715274
GetList()->list2str()
52725275
@@ -5339,6 +5342,8 @@ listener_add({callback} [, {buf}]) *listener_add()*
53395342
The {callback} is also not invoked when the buffer is
53405343
unloaded, use the |BufUnload| autocmd event for that.
53415344

5345+
Returns zero if {callback} or {buf} is invalid.
5346+
53425347
Can also be used as a |method|, the base is passed as the
53435348
second argument: >
53445349
GetBuffer()->listener_add(callback)
@@ -5371,6 +5376,7 @@ log({expr}) *log()*
53715376
Return the natural logarithm (base e) of {expr} as a |Float|.
53725377
{expr} must evaluate to a |Float| or a |Number| in the range
53735378
(0, inf].
5379+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
53745380
Examples: >
53755381
:echo log(10)
53765382
< 2.302585 >
@@ -5386,6 +5392,7 @@ log({expr}) *log()*
53865392
log10({expr}) *log10()*
53875393
Return the logarithm of Float {expr} to base 10 as a |Float|.
53885394
{expr} must evaluate to a |Float| or a |Number|.
5395+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
53895396
Examples: >
53905397
:echo log10(1000)
53915398
< 3.0 >
@@ -5484,8 +5491,9 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
54845491
below. To get a list of all mappings see |maplist()|.
54855492

54865493
When there is no mapping for {name}, an empty String is
5487-
returned. When the mapping for {name} is empty, then "<Nop>"
5488-
is returned.
5494+
returned if {dict} is FALSE, otherwise returns an empty Dict.
5495+
When the mapping for {name} is empty, then "<Nop>" is
5496+
returned.
54895497

54905498
The {name} can have special key names, like in the ":map"
54915499
command.
@@ -5778,6 +5786,8 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
57785786
The number of matches is not limited, as it is the case with
57795787
the |:match| commands.
57805788

5789+
Returns -1 on error.
5790+
57815791
Example: >
57825792
:highlight MyGroup ctermbg=green guibg=green
57835793
:let m = matchadd("MyGroup", "TODO")
@@ -5816,6 +5826,8 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
58165826

58175827
The maximum number of positions in {pos} is 8.
58185828

5829+
Returns -1 on error.
5830+
58195831
Example: >
58205832
:highlight MyGroup ctermbg=green guibg=green
58215833
:let m = matchaddpos("MyGroup", [[23, 24], 34])
@@ -6285,6 +6297,7 @@ pathshorten({path} [, {len}]) *pathshorten()*
62856297
:echo pathshorten('~/.vim/autoload/myfile.vim', 2)
62866298
< ~/.vi/au/myfile.vim ~
62876299
It doesn't matter if the path exists or not.
6300+
Returns an empty string on error.
62886301

62896302
Can also be used as a |method|: >
62906303
GetDirectories()->pathshorten()
@@ -6314,6 +6327,7 @@ popup_ functions are documented here: |popup-functions|
63146327
pow({x}, {y}) *pow()*
63156328
Return the power of {x} to the exponent {y} as a |Float|.
63166329
{x} and {y} must evaluate to a |Float| or a |Number|.
6330+
Returns 0.0 if {x} or {y} is not a |Float| or a |Number|.
63176331
Examples: >
63186332
:echo pow(3, 3)
63196333
< 27.0 >
@@ -6690,6 +6704,7 @@ rand([{expr}]) *rand()* *random*
66906704
{expr} can be initialized by |srand()| and will be updated by
66916705
rand(). If {expr} is omitted, an internal seed value is used
66926706
and updated.
6707+
Returns -1 if {expr} is invalid.
66936708

66946709
Examples: >
66956710
:echo rand()
@@ -6779,6 +6794,8 @@ readdir({directory} [, {expr} [, {dict}]]) *readdir()*
67796794
endfunction
67806795
echo s:tree(".")
67816796
<
6797+
Returns an empty List on error.
6798+
67826799
Can also be used as a |method|: >
67836800
GetDirName()->readdir()
67846801
<
@@ -6837,7 +6854,6 @@ readdirex({directory} [, {expr} [, {dict}]]) *readdirex()*
68376854
For example, to get a list of all files in the current
68386855
directory without sorting the individual entries: >
68396856
readdirex(dirname, '1', #{sort: 'none'})
6840-
68416857
<
68426858
Can also be used as a |method|: >
68436859
GetDirName()->readdirex()
@@ -6927,8 +6943,8 @@ reltime([{start} [, {end}]]) *reltime()*
69276943
and {end}.
69286944

69296945
The {start} and {end} arguments must be values returned by
6930-
reltime(). If there is an error zero is returned in legacy
6931-
script, in Vim9 script an error is given.
6946+
reltime(). If there is an error an empty List is returned in
6947+
legacy script, in Vim9 script an error is given.
69326948

69336949
Can also be used as a |method|: >
69346950
GetStart()->reltime()
@@ -7047,7 +7063,8 @@ remote_peek({serverid} [, {retvar}]) *remote_peek()*
70477063
remote_read({serverid}, [{timeout}]) *remote_read()*
70487064
Return the oldest available reply from {serverid} and consume
70497065
it. Unless a {timeout} in seconds is given, it blocks until a
7050-
reply is available.
7066+
reply is available. Returns an empty string, if a reply is
7067+
not available or on error.
70517068
See also |clientserver|.
70527069
This function is not available in the |sandbox|.
70537070
{only available when compiled with the |+clientserver| feature}
@@ -7106,6 +7123,7 @@ remove({list}, {idx} [, {end}]) *remove()*
71067123
item as {end} a list with one item is returned. When {end}
71077124
points to an item before {idx} this is an error.
71087125
See |list-index| for possible values of {idx} and {end}.
7126+
Returns zero on error.
71097127
Example: >
71107128
:echo "last item: " .. remove(mylist, -1)
71117129
:call remove(mylist, 0, 9)
@@ -7122,6 +7140,7 @@ remove({blob}, {idx} [, {end}])
71227140
return a |Blob| with these bytes. When {idx} points to the same
71237141
byte as {end} a |Blob| with one byte is returned. When {end}
71247142
points to a byte before {idx} this is an error.
7143+
Returns zero on error.
71257144
Example: >
71267145
:echo "last byte: " .. remove(myblob, -1)
71277146
:call remove(mylist, 0, 9)
@@ -7131,6 +7150,7 @@ remove({dict}, {key})
71317150
Example: >
71327151
:echo "removed " .. remove(dict, "one")
71337152
< If there is no {key} in {dict} this is an error.
7153+
Returns zero on error.
71347154

71357155
rename({from}, {to}) *rename()*
71367156
Rename the file by the name {from} to the name {to}. This
@@ -7179,6 +7199,7 @@ reverse({object}) *reverse()*
71797199
Reverse the order of items in {object} in-place.
71807200
{object} can be a |List| or a |Blob|.
71817201
Returns {object}.
7202+
Returns zero if {object} is not a List or a Blob.
71827203
If you want an object to remain unmodified make a copy first: >
71837204
:let revlist = reverse(copy(mylist))
71847205
< Can also be used as a |method|: >
@@ -7189,6 +7210,7 @@ round({expr}) *round()*
71897210
as a |Float|. If {expr} lies halfway between two integral
71907211
values, then use the larger one (away from zero).
71917212
{expr} must evaluate to a |Float| or a |Number|.
7213+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
71927214
Examples: >
71937215
echo round(0.456)
71947216
< 0.0 >
@@ -7223,6 +7245,7 @@ screenattr({row}, {col}) *screenattr()*
72237245
Like |screenchar()|, but return the attribute. This is a rather
72247246
arbitrary number that can only be used to compare to the
72257247
attribute at other positions.
7248+
Returns -1 when row or col is out of range.
72267249

72277250
Can also be used as a |method|: >
72287251
GetRow()->screenattr(col)
@@ -7286,6 +7309,7 @@ screenpos({winid}, {lnum}, {col}) *screenpos()*
72867309
|conceal| taken into account.
72877310
If the position is in a closed fold the screen position of the
72887311
first character is returned, {col} is not used.
7312+
Returns an empty Dict if {winid} is invalid.
72897313

72907314
Can also be used as a |method|: >
72917315
GetWinid()->screenpos(lnum, col)
@@ -8346,6 +8370,7 @@ simplify({filename}) *simplify()*
83468370
sin({expr}) *sin()*
83478371
Return the sine of {expr}, measured in radians, as a |Float|.
83488372
{expr} must evaluate to a |Float| or a |Number|.
8373+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
83498374
Examples: >
83508375
:echo sin(100)
83518376
< -0.506366 >
@@ -8362,6 +8387,7 @@ sinh({expr}) *sinh()*
83628387
Return the hyperbolic sine of {expr} as a |Float| in the range
83638388
[-inf, inf].
83648389
{expr} must evaluate to a |Float| or a |Number|.
8390+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
83658391
Examples: >
83668392
:echo sinh(0.5)
83678393
< 0.521095 >
@@ -8381,6 +8407,7 @@ slice({expr}, {start} [, {end}]) *slice()*
83818407
|vim9script|. Also, composing characters are not counted.
83828408
When {end} is omitted the slice continues to the last item.
83838409
When {end} is -1 the last item is omitted.
8410+
Returns an empty value if {start} or {end} are invalid.
83848411

83858412
Can also be used as a |method|: >
83868413
GetList()->slice(offset)
@@ -8626,7 +8653,8 @@ sqrt({expr}) *sqrt()*
86268653
Return the non-negative square root of Float {expr} as a
86278654
|Float|.
86288655
{expr} must evaluate to a |Float| or a |Number|. When {expr}
8629-
is negative the result is NaN (Not a Number).
8656+
is negative the result is NaN (Not a Number). Returns 0.0 if
8657+
{expr} is not a |Float| or a |Number|.
86308658
Examples: >
86318659
:echo sqrt(100)
86328660
< 10.0 >
@@ -8707,6 +8735,8 @@ str2float({string} [, {quoted}]) *str2float()*
87078735
|substitute()|: >
87088736
let f = str2float(substitute(text, ',', '', 'g'))
87098737
<
8738+
Returns 0.0 if the conversion fails.
8739+
87108740
Can also be used as a |method|: >
87118741
let f = text->substitute(',', '', 'g')->str2float()
87128742
<
@@ -8746,6 +8776,8 @@ str2nr({string} [, {base} [, {quoted}]]) *str2nr()*
87468776
{base} is 2 a leading "0b" or "0B" is ignored.
87478777
Text after the number is silently ignored.
87488778

8779+
Returns 0 if {string} is empty or on error.
8780+
87498781
Can also be used as a |method|: >
87508782
GetText()->str2nr()
87518783
@@ -8756,6 +8788,8 @@ strcharlen({string}) *strcharlen()*
87568788
|strchars()| can count the number of characters, counting
87578789
composing characters separately.
87588790

8791+
Returns 0 if {string} is empty or on error.
8792+
87598793
Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
87608794

87618795
Can also be used as a |method|: >

runtime/doc/index.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*index.txt* For Vim version 8.2. Last change: 2022 Mar 05
1+
*index.txt* For Vim version 8.2. Last change: 2022 Jun 11
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -295,7 +295,7 @@ tag char note action in Normal mode ~
295295
|/| /{pattern}<CR> 1 search forward for the Nth occurrence of
296296
{pattern}
297297
|/<CR>| /<CR> 1 search forward for {pattern} of last search
298-
|count| 0 1 cursor to the first char of the line
298+
|0| 0 1 cursor to the first char of the line
299299
|count| 1 prepend to command to give a count
300300
|count| 2 "
301301
|count| 3 "

runtime/doc/syntax.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*syntax.txt* For Vim version 8.2. Last change: 2022 Jun 03
1+
*syntax.txt* For Vim version 8.2. Last change: 2022 Jun 10
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5395,8 +5395,8 @@ StatusLineNC status lines of not-current windows
53955395
*hl-StatusLineTerm*
53965396
StatusLineTerm Status line of current window, if it is a |terminal| window.
53975397
*hl-StatusLineTermNC*
5398-
StatusLineTermNC Status lines of not-current windows that is a |terminal|
5399-
window.
5398+
StatusLineTermNC Status lines of not-current windows that is a
5399+
|terminal| window.
54005400
*hl-TabLine*
54015401
TabLine Tab pages line, not active tab page label.
54025402
*hl-TabLineFill*

runtime/doc/todo.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*todo.txt* For Vim version 8.2. Last change: 2022 Jun 09
1+
*todo.txt* For Vim version 8.2. Last change: 2022 Jun 12
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,6 +38,9 @@ browser use: https://github.com/vim/vim/issues/1234
3838
*known-bugs*
3939
-------------------- Known bugs and current work -----------------------
4040

41+
searchpair() must call function to set timeout, not pass the time limit down
42+
(and set it many times). #10562
43+
4144
Prepare for Vim 9.0 release:
4245
- Update the user manual:
4346
- Add more to usr_50.txt as an "advanced section" of usr_41.txt

runtime/doc/usr_41.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*usr_41.txt* For Vim version 8.2. Last change: 2022 Jun 04
1+
*usr_41.txt* For Vim version 8.2. Last change: 2022 Jun 10
22

33
VIM USER MANUAL - by Bram Moolenaar
44

@@ -1509,7 +1509,7 @@ functions: >
15091509
function SetSyn(name) ~
15101510

15111511
The "<SNR>" prefix means that a function is script-local. |Vim9| functions
1512-
wil start with "def" and include argument and return types. Legacy functions
1512+
will start with "def" and include argument and return types. Legacy functions
15131513
are listed with "function".
15141514

15151515
To see what a function does, use its name as an argument for `function`: >
@@ -1667,7 +1667,7 @@ Notice that the first item of the List that range() produces is zero, thus the
16671667
last item is one less than the length of the list. Detail: Internally range()
16681668
does not actually create the list, so that a large range used in a for loop
16691669
works efficiently. When used elsewhere, the range is turned into an actual
1670-
list, which takes more time for a long ist.
1670+
list, which takes more time for a long list.
16711671

16721672
You can also specify the maximum value, the stride and even go backwards: >
16731673

runtime/doc/vim9.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*vim9.txt* For Vim version 8.2. Last change: 2022 May 21
1+
*vim9.txt* For Vim version 8.2. Last change: 2022 Jun 10
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1612,7 +1612,7 @@ and cannot be accessed by the importing script.
16121612
This mechanism exists for writing a script that can be sourced (imported) by
16131613
other scripts, while making sure these other scripts only have access to what
16141614
you want them to. This also avoids using the global namespace, which has a
1615-
risc of name collisions. For example when you have two plugins with similar
1615+
risk of name collisions. For example when you have two plugins with similar
16161616
functionality.
16171617

16181618
You can cheat by using the global namespace explicitly. That should be done
@@ -1758,7 +1758,9 @@ used: >
17581758
17591759
When the mapping is defined "<SID>name." will be replaced with <SNR> and the
17601760
script ID of the imported script.
1761-
1761+
An even simpler solution is using |<ScriptCmd>|: >
1762+
noremap ,a <ScriptCmd>name.Function()<CR>
1763+
<
17621764
*:import-cycle*
17631765
The `import` commands are executed when encountered. If script A imports
17641766
script B, and B (directly or indirectly) imports A, this will be skipped over.
@@ -2202,7 +2204,7 @@ dictionary. With some care this can be made to work, but it does not look
22022204
like real classes. On top of that, it's quite slow, because of the use of
22032205
dictionaries.
22042206

2205-
It would be good to support real classes, and this is planned for a leter
2207+
It would be good to support real classes, and this is planned for a later
22062208
version. The support is a "minimal common functionality" of class support in
22072209
most languages. It will work much like Java, which is the most popular
22082210
programming language.

0 commit comments

Comments
 (0)