@@ -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()*
53865392log10({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|
63146327pow({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
71357155rename({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 | : >
0 commit comments