Skip to content

Commit ebc4e6c

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 60dc026 + ebb01bd commit ebc4e6c

33 files changed

Lines changed: 545 additions & 1229 deletions

runtime/doc/builtin.txt

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*builtin.txt* For Vim version 8.2. Last change: 2022 May 27
1+
*builtin.txt* For Vim version 8.2. Last change: 2022 Jun 05
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -753,7 +753,7 @@ acos({expr}) *acos()*
753753
Return the arc cosine of {expr} measured in radians, as a
754754
|Float| in the range of [0, pi].
755755
{expr} must evaluate to a |Float| or a |Number| in the range
756-
[-1, 1].
756+
[-1, 1]. Otherwise acos() returns "nan".
757757
Examples: >
758758
:echo acos(0)
759759
< 1.570796 >
@@ -775,6 +775,7 @@ add({object}, {expr}) *add()*
775775
item. Use |extend()| to concatenate |Lists|.
776776
When {object} is a |Blob| then {expr} must be a number.
777777
Use |insert()| to add an item at another position.
778+
Returns 1 if {object} is not a |List| or a |Blob|.
778779

779780
Can also be used as a |method|: >
780781
mylist->add(val1)->add(val2)
@@ -877,11 +878,17 @@ argv([{nr} [, {winid}]])
877878
The {winid} argument specifies the window ID, see |argc()|.
878879
For the Vim command line arguments see |v:argv|.
879880

881+
Returns an empty string if {nr}th argument is not present in
882+
the argument list. Returns an empty List if the {winid}
883+
argument is invalid.
884+
880885
asin({expr}) *asin()*
881886
Return the arc sine of {expr} measured in radians, as a |Float|
882887
in the range of [-pi/2, pi/2].
883888
{expr} must evaluate to a |Float| or a |Number| in the range
884889
[-1, 1].
890+
Returns "nan" if {expr} is outside the range [-1, 1]. Returns
891+
0.0 if {expr} is not a |Float| or a |Number|.
885892
Examples: >
886893
:echo asin(0.8)
887894
< 0.927295 >
@@ -902,6 +909,7 @@ atan({expr}) *atan()*
902909
Return the principal value of the arc tangent of {expr}, in
903910
the range [-pi/2, +pi/2] radians, as a |Float|.
904911
{expr} must evaluate to a |Float| or a |Number|.
912+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
905913
Examples: >
906914
:echo atan(100)
907915
< 1.560797 >
@@ -918,6 +926,8 @@ atan2({expr1}, {expr2}) *atan2()*
918926
Return the arc tangent of {expr1} / {expr2}, measured in
919927
radians, as a |Float| in the range [-pi, pi].
920928
{expr1} and {expr2} must evaluate to a |Float| or a |Number|.
929+
Returns 0.0 if {expr1} or {expr2} is not a |Float| or a
930+
|Number|.
921931
Examples: >
922932
:echo atan2(-1, 1)
923933
< -0.785398 >
@@ -1002,7 +1012,7 @@ autocmd_delete({acmds}) *autocmd_delete()*
10021012
{pattern} and {cmd} are not specified, then that autocmd group
10031013
is deleted.
10041014

1005-
Returns v:true on success and v:false on failure.
1015+
Returns |v:true| on success and |v:false| on failure.
10061016
Examples: >
10071017
" :autocmd! BufLeave *.vim
10081018
let acmd = #{event: 'BufLeave', pattern: '*.vim'}
@@ -1060,6 +1070,9 @@ autocmd_get([{opts}]) *autocmd_get()*
10601070
If there are multiple commands for an autocmd event in a
10611071
group, then separate items are returned for each command.
10621072

1073+
Returns an empty List if an autocmd with the specified group
1074+
or event or pattern is not found.
1075+
10631076
Examples: >
10641077
" :autocmd MyGroup
10651078
echo autocmd_get(#{group: 'Mygroup'})
@@ -1080,7 +1093,8 @@ autocmd_get([{opts}]) *autocmd_get()*
10801093
<
10811094
balloon_gettext() *balloon_gettext()*
10821095
Return the current text in the balloon. Only for the string,
1083-
not used for the List.
1096+
not used for the List. Returns an empty string if balloon
1097+
is not present.
10841098

10851099
balloon_show({expr}) *balloon_show()*
10861100
Show {expr} inside the balloon. For the GUI {expr} is used as
@@ -1117,7 +1131,8 @@ balloon_split({msg}) *balloon_split()*
11171131
Split String {msg} into lines to be displayed in a balloon.
11181132
The splits are made for the current window size and optimize
11191133
to show debugger output.
1120-
Returns a |List| with the split lines.
1134+
Returns a |List| with the split lines. Returns an empty List
1135+
on error.
11211136
Can also be used as a |method|: >
11221137
GetText()->balloon_split()->balloon_show()
11231138
@@ -1171,7 +1186,8 @@ bufadd({name}) *bufadd()*
11711186
let bufnr = bufadd('someName')
11721187
call bufload(bufnr)
11731188
call setbufline(bufnr, 1, ['some', 'text'])
1174-
< Can also be used as a |method|: >
1189+
< Returns 0 on error.
1190+
Can also be used as a |method|: >
11751191
let bufnr = 'somename'->bufadd()
11761192
11771193
bufexists({buf}) *bufexists()*
@@ -1326,6 +1342,8 @@ byte2line({byte}) *byte2line()*
13261342
one.
13271343
Also see |line2byte()|, |go| and |:goto|.
13281344

1345+
Returns -1 if the {byte} value is invalid.
1346+
13291347
Can also be used as a |method|: >
13301348
GetOffset()->byte2line()
13311349
@@ -1397,6 +1415,8 @@ ceil({expr}) *ceil()*
13971415
echo ceil(4.0)
13981416
< 4.0
13991417

1418+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
1419+
14001420
Can also be used as a |method|: >
14011421
Compute()->ceil()
14021422
<
@@ -1413,6 +1433,7 @@ changenr() *changenr()*
14131433
When a change was made it is the number of that change. After
14141434
redo it is the number of the redone change. After undo it is
14151435
one less than the number of the undone change.
1436+
Returns 0 if the undo list is empty.
14161437

14171438
char2nr({string} [, {utf8}]) *char2nr()*
14181439
Return Number value of the first char in {string}.
@@ -1431,10 +1452,11 @@ char2nr({string} [, {utf8}]) *char2nr()*
14311452
let list = map(split(str, '\zs'), {_, val -> char2nr(val)})
14321453
< Result: [65, 66, 67]
14331454

1455+
Returns 0 if {string} is not a |String|.
1456+
14341457
Can also be used as a |method|: >
14351458
GetChar()->char2nr()
14361459
1437-
14381460
charclass({string}) *charclass()*
14391461
Return the character class of the first character in {string}.
14401462
The character class is one of:
@@ -1444,6 +1466,7 @@ charclass({string}) *charclass()*
14441466
3 emoji
14451467
other specific Unicode class
14461468
The class is used in patterns and word motions.
1469+
Returns 0 if {string} is not a |String|.
14471470

14481471

14491472
charcol({expr}) *charcol()*
@@ -1555,7 +1578,7 @@ col({expr}) The result is a Number, which is the byte index of the column
15551578
col("$") length of cursor line plus one
15561579
col("'t") column of mark t
15571580
col("'" .. markname) column of mark markname
1558-
< The first column is 1. 0 is returned for an error.
1581+
< The first column is 1. Returns 0 if {expr} is invalid.
15591582
For an uppercase mark the column may actually be in another
15601583
buffer.
15611584
For the cursor position, when 'virtualedit' is active, the
@@ -1673,6 +1696,8 @@ complete_info([{what}]) *complete_info()*
16731696
|pum_getpos()|. It's also available in |v:event| during the
16741697
|CompleteChanged| event.
16751698

1699+
Returns an empty |Dictionary| on error.
1700+
16761701
Examples: >
16771702
" Get all items
16781703
call complete_info()
@@ -1758,6 +1783,7 @@ copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
17581783
cos({expr}) *cos()*
17591784
Return the cosine of {expr}, measured in radians, as a |Float|.
17601785
{expr} must evaluate to a |Float| or a |Number|.
1786+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
17611787
Examples: >
17621788
:echo cos(100)
17631789
< 0.862319 >
@@ -1774,6 +1800,7 @@ cosh({expr}) *cosh()*
17741800
Return the hyperbolic cosine of {expr} as a |Float| in the range
17751801
[1, inf].
17761802
{expr} must evaluate to a |Float| or a |Number|.
1803+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
17771804
Examples: >
17781805
:echo cosh(0.5)
17791806
< 1.127626 >
@@ -1885,6 +1912,9 @@ debugbreak({pid}) *debugbreak()*
18851912
processes is undefined. See |terminal-debugger|.
18861913
{only available on MS-Windows}
18871914

1915+
Returns |TRUE| if successfully interrupted the program.
1916+
Otherwise returns |FALSE|.
1917+
18881918
Can also be used as a |method|: >
18891919
GetPid()->debugbreak()
18901920
@@ -2355,6 +2385,7 @@ exp({expr}) *exp()*
23552385
Return the exponential of {expr} as a |Float| in the range
23562386
[0, inf].
23572387
{expr} must evaluate to a |Float| or a |Number|.
2388+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
23582389
Examples: >
23592390
:echo exp(2)
23602391
< 7.389056 >
@@ -2521,7 +2552,7 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()*
25212552
{expr2} remains unchanged.
25222553
When {expr1} is locked and {expr2} is not empty the operation
25232554
fails.
2524-
Returns {expr1}.
2555+
Returns {expr1}. Returns 0 on error.
25252556

25262557
Can also be used as a |method|: >
25272558
mylist->extend(otherlist)
@@ -2695,6 +2726,8 @@ finddir({name} [, {path} [, {count}]]) *finddir()*
26952726
{name} in {path} instead of the first one.
26962727
When {count} is negative return all the matches in a |List|.
26972728

2729+
Returns an empty string if the directory is not found.
2730+
26982731
This is quite similar to the ex-command `:find`.
26992732
{only available when compiled with the |+file_in_path|
27002733
feature}
@@ -2745,6 +2778,7 @@ float2nr({expr}) *float2nr()*
27452778
Convert {expr} to a Number by omitting the part after the
27462779
decimal point.
27472780
{expr} must evaluate to a |Float| or a Number.
2781+
Returns 0 if {expr} is not a |Float| or a |Number|.
27482782
When the value of {expr} is out of range for a |Number| the
27492783
result is truncated to 0x7fffffff or -0x7fffffff (or when
27502784
64-bit Number support is enabled, 0x7fffffffffffffff or
@@ -2772,6 +2806,7 @@ floor({expr}) *floor()*
27722806
Return the largest integral value less than or equal to
27732807
{expr} as a |Float| (round down).
27742808
{expr} must evaluate to a |Float| or a |Number|.
2809+
Returns 0.0 if {expr} is not a |Float| or a |Number|.
27752810
Examples: >
27762811
echo floor(1.856)
27772812
< 1.0 >
@@ -2794,6 +2829,8 @@ fmod({expr1}, {expr2}) *fmod()*
27942829
the magnitude of {expr2}. If {expr2} is zero, the value
27952830
returned is zero. The value returned is a |Float|.
27962831
{expr1} and {expr2} must evaluate to a |Float| or a |Number|.
2832+
Returns 0.0 if {expr1} or {expr2} is not a |Float| or a
2833+
|Number|.
27972834
Examples: >
27982835
:echo fmod(12.33, 1.22)
27992836
< 0.13 >
@@ -2815,6 +2852,7 @@ fnameescape({string}) *fnameescape()*
28152852
appears in a filename, it depends on the value of 'isfname'.
28162853
A leading '+' and '>' is also escaped (special after |:edit|
28172854
and |:write|). And a "-" by itself (special after |:cd|).
2855+
Returns an empty string on error.
28182856
Example: >
28192857
:let fname = '+some str%nge|name'
28202858
:exe "edit " .. fnameescape(fname)
@@ -2832,7 +2870,8 @@ fnamemodify({fname}, {mods}) *fnamemodify()*
28322870
:echo fnamemodify("main.c", ":p:h")
28332871
< results in: >
28342872
/home/mool/vim/vim/src
2835-
< If {mods} is empty then {fname} is returned.
2873+
< If {mods} is empty or an unsupported modifier is used then
2874+
{fname} is returned.
28362875
Note: Environment variables don't work in {fname}, use
28372876
|expand()| first then.
28382877

@@ -2889,6 +2928,7 @@ foldtext() Returns a String, to be displayed for a closed fold. This is
28892928
When used to draw the actual foldtext, the rest of the line
28902929
will be filled with the fold char from the 'fillchars'
28912930
setting.
2931+
Returns an empty string when there is no fold.
28922932
{not available when compiled without the |+folding| feature}
28932933

28942934
foldtextresult({lnum}) *foldtextresult()*
@@ -2940,6 +2980,7 @@ funcref({name} [, {arglist}] [, {dict}])
29402980
been loaded (to avoid mistakenly loading the autoload script
29412981
when only intending to use the function name, use |function()|
29422982
instead). {name} cannot be a builtin function.
2983+
Returns 0 on error.
29432984

29442985
Can also be used as a |method|: >
29452986
GetFuncname()->funcref([arg])
@@ -3020,6 +3061,8 @@ function({name} [, {arglist}] [, {dict}])
30203061
< Invokes the function as with: >
30213062
call context.Callback('one', 500)
30223063
<
3064+
Returns 0 on error.
3065+
30233066
Can also be used as a |method|: >
30243067
GetFuncname()->function([arg])
30253068
@@ -3073,6 +3116,7 @@ get({func}, {what})
30733116
"func" The function
30743117
"dict" The dictionary
30753118
"args" The list with arguments
3119+
Returns zero on error.
30763120
Preferably used as a |method|: >
30773121
myfunc->get(what)
30783122
<
@@ -3315,7 +3359,7 @@ getcharmod() *getcharmod()*
33153359
128 command (Macintosh only)
33163360
Only the modifiers that have not been included in the
33173361
character itself are obtained. Thus Shift-a results in "A"
3318-
without a modifier.
3362+
without a modifier. Returns 0 if no modifiers are used.
33193363

33203364
*getcharpos()*
33213365
getcharpos({expr})
@@ -3665,7 +3709,7 @@ getftype({fname}) *getftype()*
36653709
36663710
getimstatus() *getimstatus()*
36673711
The result is a Number, which is |TRUE| when the IME status is
3668-
active.
3712+
active and |FALSE| otherwise.
36693713
See 'imstatusfunc'.
36703714

36713715
getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
@@ -3675,7 +3719,8 @@ getjumplist([{winnr} [, {tabnr}]]) *getjumplist()*
36753719
With {winnr} only use this window in the current tab page.
36763720
{winnr} can also be a |window-ID|.
36773721
With {winnr} and {tabnr} use the window in the specified tab
3678-
page.
3722+
page. If {winnr} or {tabnr} is invalid, an empty list is
3723+
returned.
36793724

36803725
The returned list contains two entries: a list with the jump
36813726
locations and the last used jump position number in the list.
@@ -3756,7 +3801,8 @@ getmarklist([{buf}]) *getmarklist()*
37563801

37573802
If the optional {buf} argument is specified, returns the
37583803
local marks defined in buffer {buf}. For the use of {buf},
3759-
see |bufname()|.
3804+
see |bufname()|. If {buf} is invalid, an empty list is
3805+
returned.
37603806

37613807
Each item in the returned List is a |Dict| with the following:
37623808
mark name of the mark prefixed by "'"
@@ -3778,7 +3824,8 @@ getmatches([{win}]) *getmatches()*
37783824
as |setmatches()| can restore a list of matches saved by
37793825
|getmatches()|.
37803826
If {win} is specified, use the window with this number or
3781-
window ID instead of the current window.
3827+
window ID instead of the current window. If {win} is invalid,
3828+
an empty list is returned.
37823829
Example: >
37833830
:echo getmatches()
37843831
< [{'group': 'MyGroup1', 'pattern': 'TODO',
@@ -3850,6 +3897,7 @@ getpos({expr}) Get the position for String {expr}. For possible values of
38503897
use |getcharpos()|.
38513898
A very large column number equal to |v:maxcol| can be returned,
38523899
in which case it means "after the end of the line".
3900+
If {expr} is invalid, returns a list with all zeros.
38533901
This can be used to save and restore the position of a mark: >
38543902
let save_a_mark = getpos("'a")
38553903
...
@@ -6870,7 +6918,9 @@ reltime([{start} [, {end}]]) *reltime()*
68706918
The item can be passed to |reltimestr()| to convert it to a
68716919
string or |reltimefloat()| to convert to a Float.
68726920

6873-
Without an argument reltime() returns the current time.
6921+
Without an argument reltime() returns the current time (the
6922+
representation is system-dependend, it can not be used as the
6923+
wall-clock time, see |localtime()| for that).
68746924
With one argument is returns the time passed since the time
68756925
specified in the argument.
68766926
With two arguments it returns the time passed between {start}
@@ -10095,6 +10145,7 @@ winnr([{arg}]) The result is a Number, which is the number of the current
1009510145
current window (where |CTRL-W_l| goes to).
1009610146
The number can be used with |CTRL-W_w| and ":wincmd w"
1009710147
|:wincmd|.
10148+
When {arg} is invalid an error is given and zero is returned.
1009810149
Also see |tabpagewinnr()| and |win_getid()|.
1009910150
Examples: >
1010010151
let window_count = winnr('$')

runtime/doc/channel.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*channel.txt* For Vim version 8.2. Last change: 2022 Apr 16
1+
*channel.txt* For Vim version 8.2. Last change: 2022 Jun 04
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar

0 commit comments

Comments
 (0)