aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-07-28 14:48:41 +0100
committerGitHub <noreply@github.com>2023-07-28 14:48:41 +0100
commit42333ea98dfcd2994ee128a3467dfe68205154cd (patch)
tree79df4cf00f96ce5d9c549c12533253722e200461 /src/nvim/eval.lua
parentc1c2a1b5dd1d73e5e97b94e6626aaac25a3db9bc (diff)
downloadrneovim-42333ea98dfcd2994ee128a3467dfe68205154cd.tar.gz
rneovim-42333ea98dfcd2994ee128a3467dfe68205154cd.tar.bz2
rneovim-42333ea98dfcd2994ee128a3467dfe68205154cd.zip
feat(docs): generate builtin.txt (#24493)
- eval.lua is now the source of truth. - Formatting is much more consistent. - Fixed Lua type generation for polymorphic functions (get(), etc). - Removed "Overview" section from builtin.txt - Can generate this if we really want it. - Moved functions from sign.txt and testing.txt into builtin.txt. - Removed the *timer* *timers* tags since libuv timers via vim.uv should be preferred. - Removed the temp-file-name tag from tempname() - Moved lueval() from lua.txt to builtin.txt. * Fix indent * fixup! * fixup! fixup! * fixup! better tag formatting * fixup: revert changes no longer needed * fixup! CI --------- Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/nvim/eval.lua')
-rw-r--r--src/nvim/eval.lua13886
1 files changed, 13407 insertions, 479 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 173c99e271..266873308c 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -3,6 +3,7 @@
-- Keys:
--
--- @class vim.EvalFn
+--- @field name? string
--- @field args? integer|integer[] Number of arguments, list with maximum and minimum number of arguments
--- or list with a minimum number of arguments only. Defaults to zero
--- arguments.
@@ -11,502 +12,13429 @@
--- Defaults to BASE_NONE (function cannot be used as a method).
--- @field func? string Name of the C function which implements the Vimscript function. Defaults to
--- `f_{funcname}`.
+--- @field float_func? string
--- @field fast? boolean Function can run in |api-fast| events. Defaults to false.
---- @field deprecated? string[]
+--- @field deprecated? true
--- @field returns? string|false
+--- @field signature string
+--- @field desc? string
+--- @field params {[1]:string, [2]:string}[]
+--- @field lua? false Do not render type information
+--- @field tags? string[] Extra tags
+--- @field data? string Used by gen_eval.lua
-- Usable with the base key: use the last function argument as the method base.
-- Value is from funcs.h file. "BASE_" prefix is omitted.
-- local LAST = "BASE_LAST" (currently unused after port of v8.2.1168)
-local VIMBOOL = '0|1'
-
-return {
- --- @type table<string,vim.EvalFn>
- funcs={
- abs={args=1, base=1},
- acos={args=1, base=1, float_func="acos", returns='number'}, -- WJMc
- add={args=2, base=1},
- ['and']={args=2, base=1},
- api_info={fast=true},
- append={args=2, base=2},
- appendbufline={args=3, base=3},
- argc={args={0, 1}, returns='integer'},
- argidx={returns='integer'},
- arglistid={args={0, 2}, returns='integer'},
- argv={args={0, 2}},
- asin={args=1, base=1, float_func="asin"}, -- WJMc
- assert_beeps={args=1, base=1, returns=VIMBOOL},
- assert_equal={args={2, 3}, base=2, returns=VIMBOOL},
- assert_equalfile={args={2, 3}, base=1},
- assert_exception={args={1, 2}, returns=VIMBOOL},
- assert_fails={args={1, 5}, base=1, returns=VIMBOOL},
- assert_false={args={1, 2}, base=1, returns=VIMBOOL},
- assert_inrange={args={3, 4}, base=3, returns=VIMBOOL},
- assert_match={args={2, 3}, base=2, returns=VIMBOOL},
- assert_nobeep={args=1, base=1, returns=VIMBOOL},
- assert_notequal={args={2, 3}, base=2},
- assert_notmatch={args={2, 3}, base=2},
- assert_report={args=1, base=1},
- assert_true={args={1, 2}, base=1},
- atan={args=1, base=1, float_func="atan", returns='number'},
- atan2={args=2, base=1, returns='number'},
- blob2list={args=1, base=1},
- browse={args=4},
- browsedir={args=2},
- bufadd={args=1, base=1, returns='integer'},
- bufexists={args=1, base=1, returns=VIMBOOL},
- buffer_exists={
- args=1, base=1, func='f_bufexists',
- deprecated = { 'Obsolete name for |bufexists()|.' }
+local M = {}
+
+local VARARGS = { { '...', 'any' } }
+
+--- @type table<string,vim.EvalFn>
+M.funcs = {
+ abs = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Return the absolute value of {expr}. When {expr} evaluates to
+ a |Float| abs() returns a |Float|. When {expr} can be
+ converted to a |Number| abs() returns a |Number|. Otherwise
+ abs() gives an error message and returns -1.
+ Examples: >
+ echo abs(1.456)
+ < 1.456 >
+ echo abs(-5.456)
+ < 5.456 >
+ echo abs(-4)
+ < 4
+
+ Can also be used as a |method|: >
+ Compute()->abs()
+
+ ]=],
+ name = 'abs',
+ params = { { 'expr', 'any' } },
+ signature = 'abs({expr})',
+ returns = 'number'
+ },
+ acos = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Return the arc cosine of {expr} measured in radians, as a
+ |Float| in the range of [0, pi].
+ {expr} must evaluate to a |Float| or a |Number| in the range
+ [-1, 1].
+ Returns NaN if {expr} is outside the range [-1, 1]. Returns
+ 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo acos(0)
+ < 1.570796 >
+ :echo acos(-0.5)
+ < 2.094395
+
+ Can also be used as a |method|: >
+ Compute()->acos()
+
+ ]=],
+ float_func = 'acos',
+ name = 'acos',
+ params = { { 'expr', 'any' } },
+ returns = 'number',
+ signature = 'acos({expr})',
+ },
+ add = {
+ args = 2,
+ base = 1,
+ desc = [=[
+ Append the item {expr} to |List| or |Blob| {object}. Returns
+ the resulting |List| or |Blob|. Examples: >
+ :let alist = add([1, 2, 3], item)
+ :call add(mylist, "woodstock")
+ <Note that when {expr} is a |List| it is appended as a single
+ item. Use |extend()| to concatenate |Lists|.
+ When {object} is a |Blob| then {expr} must be a number.
+ Use |insert()| to add an item at another position.
+ Returns 1 if {object} is not a |List| or a |Blob|.
+
+ Can also be used as a |method|: >
+ mylist->add(val1)->add(val2)
+
+ ]=],
+ name = 'add',
+ params = { { 'object', 'any' }, { 'expr', 'any' } },
+ returns = 'any',
+ signature = 'add({object}, {expr})',
+ },
+ ['and'] = {
+ args = 2,
+ base = 1,
+ desc = [=[
+ Bitwise AND on the two arguments. The arguments are converted
+ to a number. A List, Dict or Float argument causes an error.
+ Also see `or()` and `xor()`.
+ Example: >
+ :let flag = and(bits, 0x80)
+ <Can also be used as a |method|: >
+ :let flag = bits->and(0x80)
+
+ ]=],
+ name = 'and',
+ params = { { 'expr', 'any' }, { 'expr', 'any' } },
+ returns = 'integer',
+ signature = 'and({expr}, {expr})',
+ },
+ api_info = {
+ desc = [=[
+ Returns Dictionary of |api-metadata|.
+
+ View it in a nice human-readable format: >
+ :lua vim.print(vim.fn.api_info())
+
+ ]=],
+ fast = true,
+ name = 'api_info',
+ params = {},
+ returns = 'table',
+ signature = 'api_info()',
+ },
+ append = {
+ args = 2,
+ base = 2,
+ desc = [=[
+ When {text} is a |List|: Append each item of the |List| as a
+ text line below line {lnum} in the current buffer.
+ Otherwise append {text} as one text line below line {lnum} in
+ the current buffer.
+ Any type of item is accepted and converted to a String.
+ {lnum} can be zero to insert a line before the first one.
+ {lnum} is used like with |getline()|.
+ Returns 1 for failure ({lnum} out of range or out of memory),
+ 0 for success. Example: >
+ :let failed = append(line('$'), "# THE END")
+ :let failed = append(0, ["Chapter 1", "the beginning"])
+
+ <Can also be used as a |method| after a List: >
+ mylist->append(lnum)
+
+ ]=],
+ name = 'append',
+ params = { { 'lnum', 'integer' }, { 'text', 'any' } },
+ returns = '0|1',
+ signature = 'append({lnum}, {text})',
+ },
+ appendbufline = {
+ args = 3,
+ base = 3,
+ desc = [=[
+ Like |append()| but append the text in buffer {expr}.
+
+ This function works only for loaded buffers. First call
+ |bufload()| if needed.
+
+ For the use of {buf}, see |bufname()|.
+
+ {lnum} is the line number to append below. Note that using
+ |line()| would use the current buffer, not the one appending
+ to. Use "$" to append at the end of the buffer. Other string
+ values are not supported.
+
+ On success 0 is returned, on failure 1 is returned.
+
+ If {buf} is not a valid buffer or {lnum} is not valid, an
+ error message is given. Example: >
+ :let failed = appendbufline(13, 0, "# THE START")
+ <
+ Can also be used as a |method| after a List: >
+ mylist->appendbufline(buf, lnum)
+
+ ]=],
+ name = 'appendbufline',
+ params = { { 'buf', 'any' }, { 'lnum', 'integer' }, { 'text', 'string' } },
+ returns = '0|1',
+ signature = 'appendbufline({buf}, {lnum}, {text})',
+ },
+ argc = {
+ args = { 0, 1 },
+ desc = [=[
+ The result is the number of files in the argument list. See
+ |arglist|.
+ If {winid} is not supplied, the argument list of the current
+ window is used.
+ If {winid} is -1, the global argument list is used.
+ Otherwise {winid} specifies the window of which the argument
+ list is used: either the window number or the window ID.
+ Returns -1 if the {winid} argument is invalid.
+ ]=],
+ name = 'argc',
+ params = { { 'winid', 'integer' } },
+ returns = 'integer',
+ signature = 'argc([{winid}])',
+ },
+ argidx = {
+ desc = [=[
+ The result is the current index in the argument list. 0 is
+ the first file. argc() - 1 is the last one. See |arglist|.
+ ]=],
+ name = 'argidx',
+ params = {},
+ returns = 'integer',
+ signature = 'argidx()',
+ },
+ arglistid = {
+ args = { 0, 2 },
+ desc = [=[
+ Return the argument list ID. This is a number which
+ identifies the argument list being used. Zero is used for the
+ global argument list. See |arglist|.
+ Returns -1 if the arguments are invalid.
+
+ Without arguments use the current window.
+ With {winnr} only use this window in the current tab page.
+ With {winnr} and {tabnr} use the window in the specified tab
+ page.
+ {winnr} can be the window number or the |window-ID|.
+ ]=],
+ name = 'arglistid',
+ params = { { 'winnr', 'integer' }, { 'tabnr', 'integer' } },
+ returns = 'integer',
+ signature = 'arglistid([{winnr} [, {tabnr}]])',
+ },
+ argv = {
+ args = { 0, 2 },
+ desc = [=[
+ The result is the {nr}th file in the argument list. See
+ |arglist|. "argv(0)" is the first one. Example: >
+ :let i = 0
+ :while i < argc()
+ : let f = escape(fnameescape(argv(i)), '.')
+ : exe 'amenu Arg.' .. f .. ' :e ' .. f .. '<CR>'
+ : let i = i + 1
+ :endwhile
+ <Without the {nr} argument, or when {nr} is -1, a |List| with
+ the whole |arglist| is returned.
+
+ The {winid} argument specifies the window ID, see |argc()|.
+ For the Vim command line arguments see |v:argv|.
+
+ Returns an empty string if {nr}th argument is not present in
+ the argument list. Returns an empty List if the {winid}
+ argument is invalid.
+
+ ]=],
+ name = 'argv',
+ params = { { 'nr', 'integer' }, { 'winid', 'integer' } },
+ returns = 'string|string[]',
+ signature = 'argv([{nr} [, {winid}]])',
+ },
+ asin = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Return the arc sine of {expr} measured in radians, as a |Float|
+ in the range of [-pi/2, pi/2].
+ {expr} must evaluate to a |Float| or a |Number| in the range
+ [-1, 1].
+ Returns NaN if {expr} is outside the range [-1, 1]. Returns
+ 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo asin(0.8)
+ < 0.927295 >
+ :echo asin(-0.5)
+ < -0.523599
+
+ Can also be used as a |method|: >
+ Compute()->asin()
+ <
+ ]=],
+ float_func = 'asin',
+ name = 'asin',
+ params = { { 'expr', 'any' } },
+ returns = 'number',
+ signature = 'asin({expr})',
+ },
+ assert_beeps = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Run {cmd} and add an error message to |v:errors| if it does
+ NOT produce a beep or visual bell.
+ Also see |assert_fails()|, |assert_nobeep()| and
+ |assert-return|.
+
+ Can also be used as a |method|: >
+ GetCmd()->assert_beeps()
+ <
+ ]=],
+ name = 'assert_beeps',
+ params = { { 'cmd', 'any' } },
+ returns = '0|1',
+ signature = 'assert_beeps({cmd})',
+ },
+ assert_equal = {
+ args = { 2, 3 },
+ base = 2,
+ desc = [=[
+ When {expected} and {actual} are not equal an error message is
+ added to |v:errors| and 1 is returned. Otherwise zero is
+ returned. |assert-return|
+ The error is in the form "Expected {expected} but got
+ {actual}". When {msg} is present it is prefixed to that.
+
+ There is no automatic conversion, the String "4" is different
+ from the Number 4. And the number 4 is different from the
+ Float 4.0. The value of 'ignorecase' is not used here, case
+ always matters.
+ Example: >
+ assert_equal('foo', 'bar')
+ <Will result in a string to be added to |v:errors|:
+ test.vim line 12: Expected 'foo' but got 'bar' ~
+
+ Can also be used as a |method|: >
+ mylist->assert_equal([1, 2, 3])
+ ]=],
+ name = 'assert_equal',
+ params = { { 'expected', 'any' }, { 'actual', 'any' }, { 'msg', 'any' } },
+ returns = '0|1',
+ signature = 'assert_equal({expected}, {actual} [, {msg}])',
+ },
+ assert_equalfile = {
+ args = { 2, 3 },
+ base = 1,
+ desc = [=[
+ When the files {fname-one} and {fname-two} do not contain
+ exactly the same text an error message is added to |v:errors|.
+ Also see |assert-return|.
+ When {fname-one} or {fname-two} does not exist the error will
+ mention that.
+
+ Can also be used as a |method|: >
+ GetLog()->assert_equalfile('expected.log')
+ ]=],
+ name = 'assert_equalfile',
+ params = {},
+ returns = '0|1',
+ signature = 'assert_equalfile({fname-one}, {fname-two})',
+ },
+ assert_exception = {
+ args = { 1, 2 },
+ desc = [=[
+ When v:exception does not contain the string {error} an error
+ message is added to |v:errors|. Also see |assert-return|.
+ This can be used to assert that a command throws an exception.
+ Using the error number, followed by a colon, avoids problems
+ with translations: >
+ try
+ commandthatfails
+ call assert_false(1, 'command should have failed')
+ catch
+ call assert_exception('E492:')
+ endtry
+ <
+ ]=],
+ name = 'assert_exception',
+ params = { { 'error', 'any' }, { 'msg', 'any' } },
+ returns = '0|1',
+ signature = 'assert_exception({error} [, {msg}])',
+ },
+ assert_fails = {
+ args = { 1, 5 },
+ base = 1,
+ desc = [=[
+ Run {cmd} and add an error message to |v:errors| if it does
+ NOT produce an error or when {error} is not found in the
+ error message. Also see |assert-return|.
+
+ When {error} is a string it must be found literally in the
+ first reported error. Most often this will be the error code,
+ including the colon, e.g. "E123:". >
+ assert_fails('bad cmd', 'E987:')
+ <
+ When {error} is a |List| with one or two strings, these are
+ used as patterns. The first pattern is matched against the
+ first reported error: >
+ assert_fails('cmd', ['E987:.*expected bool'])
+ <The second pattern, if present, is matched against the last
+ reported error. To only match the last error use an empty
+ string for the first error: >
+ assert_fails('cmd', ['', 'E987:'])
+ <
+ If {msg} is empty then it is not used. Do this to get the
+ default message when passing the {lnum} argument.
+
+ When {lnum} is present and not negative, and the {error}
+ argument is present and matches, then this is compared with
+ the line number at which the error was reported. That can be
+ the line number in a function or in a script.
+
+ When {context} is present it is used as a pattern and matched
+ against the context (script name or function name) where
+ {lnum} is located in.
+
+ Note that beeping is not considered an error, and some failing
+ commands only beep. Use |assert_beeps()| for those.
+
+ Can also be used as a |method|: >
+ GetCmd()->assert_fails('E99:')
+
+ ]=],
+ name = 'assert_fails',
+ params = {
+ { 'cmd', 'any' },
+ { 'error', 'any' },
+ { 'msg', 'any' },
+ { 'lnum', 'integer' },
+ { 'context', 'any' },
},
- buffer_name={
- args={0, 1}, base=1, func='f_bufname',
- deprecated = { 'Obsolete name for |bufname()|.' }
+ returns = '0|1',
+ signature = 'assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]])',
+ },
+ assert_false = {
+ args = { 1, 2 },
+ base = 1,
+ desc = [=[
+ When {actual} is not false an error message is added to
+ |v:errors|, like with |assert_equal()|.
+ The error is in the form "Expected False but got {actual}".
+ When {msg} is present it is prepended to that.
+ Also see |assert-return|.
+
+ A value is false when it is zero. When {actual} is not a
+ number the assert fails.
+
+ Can also be used as a |method|: >
+ GetResult()->assert_false()
+
+ ]=],
+ name = 'assert_false',
+ params = { { 'actual', 'any' }, { 'msg', 'any' } },
+ returns = '0|1',
+ signature = 'assert_false({actual} [, {msg}])',
+ },
+ assert_inrange = {
+ args = { 3, 4 },
+ base = 3,
+ desc = [=[
+ This asserts number and |Float| values. When {actual} is lower
+ than {lower} or higher than {upper} an error message is added
+ to |v:errors|. Also see |assert-return|.
+ The error is in the form "Expected range {lower} - {upper},
+ but got {actual}". When {msg} is present it is prefixed to
+ that.
+ ]=],
+ name = 'assert_inrange',
+ params = { { 'lower', 'any' }, { 'upper', 'any' }, { 'actual', 'any' }, { 'msg', 'any' } },
+ returns = '0|1',
+ signature = 'assert_inrange({lower}, {upper}, {actual} [, {msg}])',
+ },
+ assert_match = {
+ args = { 2, 3 },
+ base = 2,
+ desc = [=[
+ When {pattern} does not match {actual} an error message is
+ added to |v:errors|. Also see |assert-return|.
+ The error is in the form "Pattern {pattern} does not match
+ {actual}". When {msg} is present it is prefixed to that.
+
+ {pattern} is used as with |expr-=~|: The matching is always done
+ like 'magic' was set and 'cpoptions' is empty, no matter what
+ the actual value of 'magic' or 'cpoptions' is.
+
+ {actual} is used as a string, automatic conversion applies.
+ Use "^" and "$" to match with the start and end of the text.
+ Use both to match the whole text.
+
+ Example: >
+ assert_match('^f.*o$', 'foobar')
+ <Will result in a string to be added to |v:errors|:
+ test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
+
+ Can also be used as a |method|: >
+ getFile()->assert_match('foo.*')
+ <
+ ]=],
+ name = 'assert_match',
+ params = { { 'pattern', 'any' }, { 'actual', 'any' }, { 'msg', 'any' } },
+ returns = '0|1',
+ signature = 'assert_match({pattern}, {actual} [, {msg}])',
+ },
+ assert_nobeep = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Run {cmd} and add an error message to |v:errors| if it
+ produces a beep or visual bell.
+ Also see |assert_beeps()|.
+
+ Can also be used as a |method|: >
+ GetCmd()->assert_nobeep()
+ <
+ ]=],
+ name = 'assert_nobeep',
+ params = { { 'cmd', 'any' } },
+ returns = '0|1',
+ signature = 'assert_nobeep({cmd})',
+ },
+ assert_notequal = {
+ args = { 2, 3 },
+ base = 2,
+ desc = [=[
+ The opposite of `assert_equal()`: add an error message to
+ |v:errors| when {expected} and {actual} are equal.
+ Also see |assert-return|.
+
+ Can also be used as a |method|: >
+ mylist->assert_notequal([1, 2, 3])
+
+ <
+ ]=],
+ name = 'assert_notequal',
+ params = { { 'expected', 'any' }, { 'actual', 'any' }, { 'msg', 'any' } },
+ returns = '0|1',
+ signature = 'assert_notequal({expected}, {actual} [, {msg}])',
+ },
+ assert_notmatch = {
+ args = { 2, 3 },
+ base = 2,
+ desc = [=[
+ The opposite of `assert_match()`: add an error message to
+ |v:errors| when {pattern} matches {actual}.
+ Also see |assert-return|.
+
+ Can also be used as a |method|: >
+ getFile()->assert_notmatch('bar.*')
+ <
+ ]=],
+ name = 'assert_notmatch',
+ params = { { 'pattern', 'any' }, { 'actual', 'any' }, { 'msg', 'any' } },
+ returns = '0|1',
+ signature = 'assert_notmatch({pattern}, {actual} [, {msg}])',
+ },
+ assert_report = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Report a test failure directly, using String {msg}.
+ Always returns one.
+
+ Can also be used as a |method|: >
+ GetMessage()->assert_report()
+ <
+ ]=],
+ name = 'assert_report',
+ params = { { 'msg', 'any' } },
+ returns = '0|1',
+ signature = 'assert_report({msg})',
+ },
+ assert_true = {
+ args = { 1, 2 },
+ base = 1,
+ desc = [=[
+ When {actual} is not true an error message is added to
+ |v:errors|, like with |assert_equal()|.
+ Also see |assert-return|.
+ A value is |TRUE| when it is a non-zero number or |v:true|.
+ When {actual} is not a number or |v:true| the assert fails.
+ When {msg} is given it precedes the default message.
+
+ Can also be used as a |method|: >
+ GetResult()->assert_true()
+ <
+ ]=],
+ name = 'assert_true',
+ params = { { 'actual', 'any' }, { 'msg', 'any' } },
+ returns = '0|1',
+ signature = 'assert_true({actual} [, {msg}])',
+ },
+ atan = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Return the principal value of the arc tangent of {expr}, in
+ the range [-pi/2, +pi/2] radians, as a |Float|.
+ {expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
+ Examples: >
+ :echo atan(100)
+ < 1.560797 >
+ :echo atan(-4.01)
+ < -1.326405
+
+ Can also be used as a |method|: >
+ Compute()->atan()
+
+ ]=],
+ float_func = 'atan',
+ name = 'atan',
+ params = { { 'expr', 'any' } },
+ returns = 'number',
+ signature = 'atan({expr})',
+ },
+ atan2 = {
+ args = 2,
+ base = 1,
+ desc = [=[
+ Return the arc tangent of {expr1} / {expr2}, measured in
+ radians, as a |Float| in the range [-pi, pi].
+ {expr1} and {expr2} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr1} or {expr2} is not a |Float| or a
+ |Number|.
+ Examples: >
+ :echo atan2(-1, 1)
+ < -0.785398 >
+ :echo atan2(1, -1)
+ < 2.356194
+
+ Can also be used as a |method|: >
+ Compute()->atan2(1)
+
+ ]=],
+ name = 'atan2',
+ params = { { 'expr1', 'any' }, { 'expr2', 'any' } },
+ returns = 'number',
+ signature = 'atan2({expr1}, {expr2})',
+ },
+ blob2list = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Return a List containing the number value of each byte in Blob
+ {blob}. Examples: >
+ blob2list(0z0102.0304) returns [1, 2, 3, 4]
+ blob2list(0z) returns []
+ <Returns an empty List on error. |list2blob()| does the
+ opposite.
+
+ Can also be used as a |method|: >
+ GetBlob()->blob2list()
+ <
+ ]=],
+ name = 'blob2list',
+ params = { { 'blob', 'any' } },
+ returns = 'any[]',
+ signature = 'blob2list({blob})',
+ },
+ browse = {
+ args = 4,
+ desc = [=[
+ Put up a file requester. This only works when "has("browse")"
+ returns |TRUE| (only in some GUI versions).
+ The input fields are:
+ {save} when |TRUE|, select file to write
+ {title} title for the requester
+ {initdir} directory to start browsing in
+ {default} default file name
+ An empty string is returned when the "Cancel" button is hit,
+ something went wrong, or browsing is not possible.
+ ]=],
+ name = 'browse',
+ params = { { 'save', 'any' }, { 'title', 'any' }, { 'initdir', 'any' }, { 'default', 'any' } },
+ returns = '0|1',
+ signature = 'browse({save}, {title}, {initdir}, {default})',
+ },
+ browsedir = {
+ args = 2,
+ desc = [=[
+ Put up a directory requester. This only works when
+ "has("browse")" returns |TRUE| (only in some GUI versions).
+ On systems where a directory browser is not supported a file
+ browser is used. In that case: select a file in the directory
+ to be used.
+ The input fields are:
+ {title} title for the requester
+ {initdir} directory to start browsing in
+ When the "Cancel" button is hit, something went wrong, or
+ browsing is not possible, an empty string is returned.
+
+ ]=],
+ name = 'browsedir',
+ params = { { 'title', 'any' }, { 'initdir', 'any' } },
+ returns = '0|1',
+ signature = 'browsedir({title}, {initdir})',
+ },
+ bufadd = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Add a buffer to the buffer list with name {name} (must be a
+ String).
+ If a buffer for file {name} already exists, return that buffer
+ number. Otherwise return the buffer number of the newly
+ created buffer. When {name} is an empty string then a new
+ buffer is always created.
+ The buffer will not have 'buflisted' set and not be loaded
+ yet. To add some text to the buffer use this: >
+ let bufnr = bufadd('someName')
+ call bufload(bufnr)
+ call setbufline(bufnr, 1, ['some', 'text'])
+ <Returns 0 on error.
+ Can also be used as a |method|: >
+ let bufnr = 'somename'->bufadd()
+
+ ]=],
+ name = 'bufadd',
+ params = { { 'name', 'string' } },
+ returns = 'integer',
+ signature = 'bufadd({name})',
+ },
+ bufexists = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ The result is a Number, which is |TRUE| if a buffer called
+ {buf} exists.
+ If the {buf} argument is a number, buffer numbers are used.
+ Number zero is the alternate buffer for the current window.
+
+ If the {buf} argument is a string it must match a buffer name
+ exactly. The name can be:
+ - Relative to the current directory.
+ - A full path.
+ - The name of a buffer with 'buftype' set to "nofile".
+ - A URL name.
+ Unlisted buffers will be found.
+ Note that help files are listed by their short name in the
+ output of |:buffers|, but bufexists() requires using their
+ long name to be able to find them.
+ bufexists() may report a buffer exists, but to use the name
+ with a |:buffer| command you may need to use |expand()|. Esp
+ for MS-Windows 8.3 names in the form "c:\DOCUME~1"
+ Use "bufexists(0)" to test for the existence of an alternate
+ file name.
+
+ Can also be used as a |method|: >
+ let exists = 'somename'->bufexists()
+
+ ]=],
+ name = 'bufexists',
+ params = { { 'buf', 'any' } },
+ returns = '0|1',
+ signature = 'bufexists({buf})',
+ },
+ buffer_exists = {
+ args = 1,
+ base = 1,
+ deprecated = true,
+ desc = [=[
+ Obsolete name for |bufexists()|.
+ ]=],
+ func = 'f_bufexists',
+ name = 'buffer_exists',
+ params = VARARGS,
+ returns = '0|1',
+ signature = 'buffer_exists({buf})',
+ },
+ buffer_name = {
+ args = { 0, 1 },
+ base = 1,
+ deprecated = true,
+ desc = [=[
+ Obsolete name for |bufname()|.
+ ]=],
+ func = 'f_bufname',
+ name = 'buffer_name',
+ params = VARARGS,
+ returns = 'string',
+ signature = 'buffer_name([{buf}])',
+ },
+ buffer_number = {
+ args = { 0, 1 },
+ base = 1,
+ deprecated = true,
+ desc = [=[
+ Obsolete name for |bufnr()|.
+ ]=],
+ func = 'f_bufnr',
+ name = 'buffer_number',
+ params = VARARGS,
+ returns = 'integer',
+ signature = 'buffer_number([{buf} [, {create}]])',
+ },
+ buflisted = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ The result is a Number, which is |TRUE| if a buffer called
+ {buf} exists and is listed (has the 'buflisted' option set).
+ The {buf} argument is used like with |bufexists()|.
+
+ Can also be used as a |method|: >
+ let listed = 'somename'->buflisted()
+
+ ]=],
+ name = 'buflisted',
+ params = { { 'buf', 'any' } },
+ returns = '0|1',
+ signature = 'buflisted({buf})',
+ },
+ bufload = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Ensure the buffer {buf} is loaded. When the buffer name
+ refers to an existing file then the file is read. Otherwise
+ the buffer will be empty. If the buffer was already loaded
+ then there is no change. If the buffer is not related to a
+ file the no file is read (e.g., when 'buftype' is "nofile").
+ If there is an existing swap file for the file of the buffer,
+ there will be no dialog, the buffer will be loaded anyway.
+ The {buf} argument is used like with |bufexists()|.
+
+ Can also be used as a |method|: >
+ eval 'somename'->bufload()
+
+ ]=],
+ name = 'bufload',
+ params = { { 'buf', 'any' } },
+ returns = false,
+ signature = 'bufload({buf})',
+ },
+ bufloaded = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ The result is a Number, which is |TRUE| if a buffer called
+ {buf} exists and is loaded (shown in a window or hidden).
+ The {buf} argument is used like with |bufexists()|.
+
+ Can also be used as a |method|: >
+ let loaded = 'somename'->bufloaded()
+
+ ]=],
+ name = 'bufloaded',
+ params = { { 'buf', 'any' } },
+ returns = '0|1',
+ signature = 'bufloaded({buf})',
+ },
+ bufname = {
+ args = { 0, 1 },
+ base = 1,
+ desc = [=[
+ The result is the name of a buffer. Mostly as it is displayed
+ by the `:ls` command, but not using special names such as
+ "[No Name]".
+ If {buf} is omitted the current buffer is used.
+ If {buf} is a Number, that buffer number's name is given.
+ Number zero is the alternate buffer for the current window.
+ If {buf} is a String, it is used as a |file-pattern| to match
+ with the buffer names. This is always done like 'magic' is
+ set and 'cpoptions' is empty. When there is more than one
+ match an empty string is returned.
+ "" or "%" can be used for the current buffer, "#" for the
+ alternate buffer.
+ A full match is preferred, otherwise a match at the start, end
+ or middle of the buffer name is accepted. If you only want a
+ full match then put "^" at the start and "$" at the end of the
+ pattern.
+ Listed buffers are found first. If there is a single match
+ with a listed buffer, that one is returned. Next unlisted
+ buffers are searched for.
+ If the {buf} is a String, but you want to use it as a buffer
+ number, force it to be a Number by adding zero to it: >
+ :echo bufname("3" + 0)
+ <Can also be used as a |method|: >
+ echo bufnr->bufname()
+
+ <If the buffer doesn't exist, or doesn't have a name, an empty
+ string is returned. >
+ bufname("#") alternate buffer name
+ bufname(3) name of buffer 3
+ bufname("%") name of current buffer
+ bufname("file2") name of buffer where "file2" matches.
+ <
+ ]=],
+ name = 'bufname',
+ params = { { 'buf', 'any' } },
+ returns = 'string',
+ signature = 'bufname([{buf}])',
+ },
+ bufnr = {
+ args = { 0, 2 },
+ base = 1,
+ desc = [=[
+ The result is the number of a buffer, as it is displayed by
+ the `:ls` command. For the use of {buf}, see |bufname()|
+ above.
+ If the buffer doesn't exist, -1 is returned. Or, if the
+ {create} argument is present and TRUE, a new, unlisted,
+ buffer is created and its number is returned.
+ bufnr("$") is the last buffer: >
+ :let last_buffer = bufnr("$")
+ <The result is a Number, which is the highest buffer number
+ of existing buffers. Note that not all buffers with a smaller
+ number necessarily exist, because ":bwipeout" may have removed
+ them. Use bufexists() to test for the existence of a buffer.
+
+ Can also be used as a |method|: >
+ echo bufref->bufnr()
+
+ ]=],
+ name = 'bufnr',
+ params = { { 'buf', 'any' }, { 'create', 'any' } },
+ returns = 'integer',
+ signature = 'bufnr([{buf} [, {create}]])',
+ },
+ bufwinid = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ The result is a Number, which is the |window-ID| of the first
+ window associated with buffer {buf}. For the use of {buf},
+ see |bufname()| above. If buffer {buf} doesn't exist or
+ there is no such window, -1 is returned. Example: >
+
+ echo "A window containing buffer 1 is " .. (bufwinid(1))
+ <
+ Only deals with the current tab page. See |win_findbuf()| for
+ finding more.
+
+ Can also be used as a |method|: >
+ FindBuffer()->bufwinid()
+
+ ]=],
+ name = 'bufwinid',
+ params = { { 'buf', 'any' } },
+ returns = 'integer',
+ signature = 'bufwinid({buf})',
+ },
+ bufwinnr = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Like |bufwinid()| but return the window number instead of the
+ |window-ID|.
+ If buffer {buf} doesn't exist or there is no such window, -1
+ is returned. Example: >
+
+ echo "A window containing buffer 1 is " .. (bufwinnr(1))
+
+ <The number can be used with |CTRL-W_w| and ":wincmd w"
+ |:wincmd|.
+
+ Can also be used as a |method|: >
+ FindBuffer()->bufwinnr()
+
+ ]=],
+ name = 'bufwinnr',
+ params = { { 'buf', 'any' } },
+ returns = 'integer',
+ signature = 'bufwinnr({buf})',
+ },
+ byte2line = {
+ args = 1,
+ base = 1,
+ desc = [=[
+ Return the line number that contains the character at byte
+ count {byte} in the current buffer. This includes the
+ end-of-line character, depending on the 'fileformat' option
+ for the current buffer. The first character has byte count
+ one.
+ Also see |line2byte()|, |go| and |:goto|.
+
+ Returns -1 if th