diff options
| author | Lewis Russell <lewis6991@gmail.com> | 2023-08-01 09:57:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-01 09:57:52 +0100 |
| commit | 9b5f58185e1ff0597c7e95b7205d9ec11be1848c (patch) | |
| tree | 10c93b683b66a0c809f47c891c194c4ca6932f87 /src/nvim/eval.lua | |
| parent | 12ccea59674602ddf44d6e2394bf9da87b6feeb9 (diff) | |
| download | rneovim-9b5f58185e1ff0597c7e95b7205d9ec11be1848c.tar.gz rneovim-9b5f58185e1ff0597c7e95b7205d9ec11be1848c.tar.bz2 rneovim-9b5f58185e1ff0597c7e95b7205d9ec11be1848c.zip | |
docs(builtin): fix and annotate language blocks (#24506)
Diffstat (limited to 'src/nvim/eval.lua')
| -rw-r--r-- | src/nvim/eval.lua | 3115 |
1 files changed, 1545 insertions, 1570 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 266873308c..9acfa0984a 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -41,17 +41,17 @@ M.funcs = { 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: > + Examples: >vim echo abs(1.456) - < 1.456 > + < 1.456 >vim echo abs(-5.456) - < 5.456 > + < 5.456 >vim echo abs(-4) < 4 - Can also be used as a |method|: > + Can also be used as a |method|: >vim Compute()->abs() - + < ]=], name = 'abs', params = { { 'expr', 'any' } }, @@ -68,15 +68,15 @@ M.funcs = { [-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) + Examples: >vim + echo acos(0) + < 1.570796 >vim + echo acos(-0.5) < 2.094395 - Can also be used as a |method|: > + Can also be used as a |method|: >vim Compute()->acos() - + < ]=], float_func = 'acos', name = 'acos', @@ -89,18 +89,18 @@ M.funcs = { 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") + the resulting |List| or |Blob|. Examples: >vim + 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|: > + Can also be used as a |method|: >vim mylist->add(val1)->add(val2) - + < ]=], name = 'add', params = { { 'object', 'any' }, { 'expr', 'any' } }, @@ -114,11 +114,11 @@ M.funcs = { 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) - + Example: >vim + let flag = and(bits, 0x80) + <Can also be used as a |method|: >vim + let flag = bits->and(0x80) + < ]=], name = 'and', params = { { 'expr', 'any' }, { 'expr', 'any' } }, @@ -129,9 +129,9 @@ M.funcs = { desc = [=[ Returns Dictionary of |api-metadata|. - View it in a nice human-readable format: > - :lua vim.print(vim.fn.api_info()) - + View it in a nice human-readable format: >vim + lua vim.print(vim.fn.api_info()) + < ]=], fast = true, name = 'api_info', @@ -151,13 +151,13 @@ M.funcs = { {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"]) + 0 for success. Example: >vim + let failed = append(line('$'), "# THE END") + let failed = append(0, ["Chapter 1", "the beginning"]) - <Can also be used as a |method| after a List: > + <Can also be used as a |method| after a List: >vim mylist->append(lnum) - + < ]=], name = 'append', params = { { 'lnum', 'integer' }, { 'text', 'any' } }, @@ -183,12 +183,12 @@ M.funcs = { 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") + error message is given. Example: >vim + let failed = appendbufline(13, 0, "# THE START") < - Can also be used as a |method| after a List: > + Can also be used as a |method| after a List: >vim mylist->appendbufline(buf, lnum) - + < ]=], name = 'appendbufline', params = { { 'buf', 'any' }, { 'lnum', 'integer' }, { 'text', 'string' } }, @@ -245,13 +245,13 @@ M.funcs = { 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 + |arglist|. "argv(0)" is the first one. Example: >vim + 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. @@ -261,7 +261,6 @@ M.funcs = { 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' } }, @@ -278,13 +277,13 @@ M.funcs = { [-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) + Examples: >vim + echo asin(0.8) + < 0.927295 >vim + echo asin(-0.5) < -0.523599 - Can also be used as a |method|: > + Can also be used as a |method|: >vim Compute()->asin() < ]=], @@ -303,7 +302,7 @@ M.funcs = { Also see |assert_fails()|, |assert_nobeep()| and |assert-return|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetCmd()->assert_beeps() < ]=], @@ -326,13 +325,14 @@ M.funcs = { 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: > + Example: >vim 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|: > + Can also be used as a |method|: >vim mylist->assert_equal([1, 2, 3]) + < ]=], name = 'assert_equal', params = { { 'expected', 'any' }, { 'actual', 'any' }, { 'msg', 'any' } }, @@ -349,8 +349,9 @@ M.funcs = { When {fname-one} or {fname-two} does not exist the error will mention that. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetLog()->assert_equalfile('expected.log') + < ]=], name = 'assert_equalfile', params = {}, @@ -364,7 +365,7 @@ M.funcs = { 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: > + with translations: >vim try commandthatfails call assert_false(1, 'command should have failed') @@ -388,16 +389,16 @@ M.funcs = { 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:". > + including the colon, e.g. "E123:". >vim 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: > + first reported error: >vim 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: > + string for the first error: >vim assert_fails('cmd', ['', 'E987:']) < If {msg} is empty then it is not used. Do this to get the @@ -415,9 +416,9 @@ M.funcs = { 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|: > + Can also be used as a |method|: >vim GetCmd()->assert_fails('E99:') - + < ]=], name = 'assert_fails', params = { @@ -443,9 +444,9 @@ M.funcs = { A value is false when it is zero. When {actual} is not a number the assert fails. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetResult()->assert_false() - + < ]=], name = 'assert_false', params = { { 'actual', 'any' }, { 'msg', 'any' } }, @@ -485,12 +486,12 @@ M.funcs = { Use "^" and "$" to match with the start and end of the text. Use both to match the whole text. - Example: > + Example: >vim 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|: > + Can also be used as a |method|: >vim getFile()->assert_match('foo.*') < ]=], @@ -507,7 +508,7 @@ M.funcs = { produces a beep or visual bell. Also see |assert_beeps()|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetCmd()->assert_nobeep() < ]=], @@ -524,9 +525,8 @@ M.funcs = { |v:errors| when {expected} and {actual} are equal. Also see |assert-return|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim mylist->assert_notequal([1, 2, 3]) - < ]=], name = 'assert_notequal', @@ -542,7 +542,7 @@ M.funcs = { |v:errors| when {pattern} matches {actual}. Also see |assert-return|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim getFile()->assert_notmatch('bar.*') < ]=], @@ -558,7 +558,7 @@ M.funcs = { Report a test failure directly, using String {msg}. Always returns one. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetMessage()->assert_report() < ]=], @@ -578,7 +578,7 @@ M.funcs = { 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|: > + Can also be used as a |method|: >vim GetResult()->assert_true() < ]=], @@ -595,15 +595,15 @@ M.funcs = { 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) + Examples: >vim + echo atan(100) + < 1.560797 >vim + echo atan(-4.01) < -1.326405 - Can also be used as a |method|: > + Can also be used as a |method|: >vim Compute()->atan() - + < ]=], float_func = 'atan', name = 'atan', @@ -620,15 +620,15 @@ M.funcs = { {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) + Examples: >vim + echo atan2(-1, 1) + < -0.785398 >vim + echo atan2(1, -1) < 2.356194 - Can also be used as a |method|: > + Can also be used as a |method|: >vim Compute()->atan2(1) - + < ]=], name = 'atan2', params = { { 'expr1', 'any' }, { 'expr2', 'any' } }, @@ -640,13 +640,13 @@ M.funcs = { 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 [] + {blob}. Examples: >vim + 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|: > + Can also be used as a |method|: >vim GetBlob()->blob2list() < ]=], @@ -686,7 +686,6 @@ M.funcs = { {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' } }, @@ -704,14 +703,14 @@ M.funcs = { 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: > + yet. To add some text to the buffer use this: >vim let bufnr = bufadd('someName') call bufload(bufnr) call setbufline(bufnr, 1, ['some', 'text']) <Returns 0 on error. - Can also be used as a |method|: > + Can also be used as a |method|: >vim let bufnr = 'somename'->bufadd() - + < ]=], name = 'bufadd', params = { { 'name', 'string' } }, @@ -743,9 +742,9 @@ M.funcs = { Use "bufexists(0)" to test for the existence of an alternate file name. - Can also be used as a |method|: > + Can also be used as a |method|: >vim let exists = 'somename'->bufexists() - + < ]=], name = 'bufexists', params = { { 'buf', 'any' } }, @@ -799,9 +798,9 @@ M.funcs = { {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|: > + Can also be used as a |method|: >vim let listed = 'somename'->buflisted() - + < ]=], name = 'buflisted', params = { { 'buf', 'any' } }, @@ -821,9 +820,9 @@ M.funcs = { 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|: > + Can also be used as a |method|: >vim eval 'somename'->bufload() - + < ]=], name = 'bufload', params = { { 'buf', 'any' } }, @@ -838,9 +837,9 @@ M.funcs = { {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|: > + Can also be used as a |method|: >vim let loaded = 'somename'->bufloaded() - + < ]=], name = 'bufloaded', params = { { 'buf', 'any' } }, @@ -871,17 +870,17 @@ M.funcs = { 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|: > + number, force it to be a Number by adding zero to it: >vim + echo bufname("3" + 0) + <Can also be used as a |method|: >vim 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. + string is returned. >vim + echo bufname("#") " alternate buffer name + echo bufname(3) " name of buffer 3 + echo bufname("%") " name of current buffer + echo bufname("file2") " name of buffer where "file2" matches. < ]=], name = 'bufname', @@ -899,16 +898,16 @@ M.funcs = { 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("$") + bufnr("$") is the last buffer: >vim + 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|: > + Can also be used as a |method|: >vim echo bufref->bufnr() - + < ]=], name = 'bufnr', params = { { 'buf', 'any' }, { 'create', 'any' } }, @@ -922,16 +921,16 @@ M.funcs = { 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: > + there is no such window, -1 is returned. Example: >vim 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|: > + Can also be used as a |method|: >vim FindBuffer()->bufwinid() - + < ]=], name = 'bufwinid', params = { { 'buf', 'any' } }, @@ -945,16 +944,16 @@ M.funcs = { 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: > + is returned. Example: >vim 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|: > + Can also be used as a |method|: >vim FindBuffer()->bufwinnr() - + < ]=], name = 'bufwinnr', params = { { 'buf', 'any' } }, @@ -974,9 +973,9 @@ M.funcs = { Returns -1 if the {byte} value is invalid. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetOffset()->byte2line() - + < ]=], name = 'byte2line', params = { { 'byte', 'any' } }, @@ -1003,10 +1002,10 @@ M.funcs = { middle of a character (e.g. in a 4-byte character), then the byte index of the first byte in the character is returned. Refer to |string-offset-encoding| for more information. - Example : > + Example : >vim echo matchstr(str, ".", byteidx(str, 3)) <will display the fourth character. Another way to do the - same: > + same: >vim let s = strpart(str, byteidx(str, 3)) echo strpart(s, 0, byteidx(s, 1)) <Also see |strgetchar()| and |strcharpart()|. @@ -1016,14 +1015,14 @@ M.funcs = { in bytes is returned. See |charidx()| and |utf16idx()| for getting the character and UTF-16 index respectively from the byte index. - Examples: > - echo byteidx('a๐๐', 2) returns 5 - echo byteidx('a๐๐', 2, 1) returns 1 - echo byteidx('a๐๐', 3, 1) returns 5 + Examples: >vim + echo byteidx('a๐๐', 2) " returns 5 + echo byteidx('a๐๐', 2, 1) " returns 1 + echo byteidx('a๐๐', 3, 1) " returns 5 < - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetName()->byteidx(idx) - + < ]=], fast = true, name = 'byteidx', @@ -1036,7 +1035,7 @@ M.funcs = { base = 1, desc = [=[ Like byteidx(), except that a composing character is counted - as a separate character. Example: > + as a separate character. Example: >vim let s = 'e' .. nr2char(0x301) echo byteidx(s, 1) echo byteidxcomp(s, 1) @@ -1045,9 +1044,9 @@ M.funcs = { character is 3 bytes), the second echo results in 1 ('e' is one byte). - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetName()->byteidxcomp(idx) - + < ]=], fast = true, name = 'byteidxcomp', @@ -1067,7 +1066,7 @@ M.funcs = { {dict} is for functions with the "dict" attribute. It will be used to set the local variable "self". |Dictionary-function| - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetFunc()->call([arg, arg], dict) < ]=], @@ -1084,17 +1083,17 @@ M.funcs = { Return the smallest integral value greater than or equal to {expr} as a |Float| (round up). {expr} must evaluate to a |Float| or a |Number|. - Examples: > + Examples: >vim echo ceil(1.456) - < 2.0 > + < 2.0 >vim echo ceil(-5.456) - < -5.0 > + < -5.0 >vim echo ceil(4.0) < 4.0 Returns 0.0 if {expr} is not a |Float| or a |Number|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim Compute()->ceil() < ]=], @@ -1148,14 +1147,13 @@ M.funcs = { {data} may be a string, string convertible, |Blob|, or a list. If {data} is a list, the items will be joined by newlines; any newlines in an item will be sent as NUL. To send a final - newline, include a final empty string. Example: > - :call chansend(id, ["abc", "123\n456", ""]) + newline, include a final empty string. Example: >vim + call chansend(id, ["abc", "123\n456", ""]) <will send "abc<NL>123<NUL>456<NL>". chansend() writes raw data, not RPC messages. If the channel was created with `"rpc":v:true` then the channel expects RPC messages, use |rpcnotify()| and |rpcrequest()| instead. - ]=], name = 'chansend', params = { { 'id', 'any' }, { 'data', 'any' } }, @@ -1167,12 +1165,12 @@ M.funcs = { base = 1, desc = [=[ Return Number value of the first char in {string}. - Examples: > - char2nr(" ") returns 32 - char2nr("ABC") returns 65 - char2nr("รก") returns 225 - char2nr("รก"[0]) returns 195 - char2nr("\<M-x>") returns 128 + Examples: >vim + echo char2nr(" ") " returns 32 + echo char2nr("ABC") " returns 65 + echo char2nr("รก") " returns 225 + echo char2nr("รก"[0]) " returns 195 + echo char2nr("\<M-x>") " returns 128 <Non-ASCII characters are always treated as UTF-8 characters. {utf8} is ignored, it exists only for backwards-compatibility. A combining character is a separate character. @@ -1180,9 +1178,9 @@ M.funcs = { Returns 0 if {string} is not a |String|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetChar()->char2nr() - + < ]=], fast = true, name = 'char2nr', @@ -1217,11 +1215,11 @@ M.funcs = { position given with {expr} instead of the byte position. Example: - With the cursor on '์ธ' in line 5 with text "์ฌ๋ณด์ธ์": > - charcol('.') returns 3 - col('.') returns 7 + With the cursor on '์ธ' in line 5 with text "์ฌ๋ณด์ธ์": >vim + echo charcol('.') " returns 3 + echo col('.') " returns 7 - <Can also be used as a |method|: > + <Can also be used as a |method|: >vim GetPos()->col() < ]=], @@ -1260,15 +1258,15 @@ M.funcs = { from the character index and |utf16idx()| for getting the UTF-16 index from the character index. Refer to |string-offset-encoding| for more information. - Examples: > - echo charidx('aฬbฬcฬ', 3) returns 1 - echo charidx('aฬbฬcฬ', 6, 1) returns 4 - echo charidx('aฬbฬcฬ', 16) returns -1 - echo charidx('a๐๐', 4, 0, 1) returns 2 + Examples: >vim + echo charidx('aฬbฬcฬ', 3) " returns 1 + echo charidx('aฬbฬcฬ', 6, 1) " returns 4 + echo charidx('aฬbฬcฬ', 16) " returns -1 + echo charidx('a๐๐', 4, 0, 1) " returns 2 < - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetName()->charidx(idx) - + < ]=], name = 'charidx', params = { @@ -1298,14 +1296,14 @@ M.funcs = { this to another chdir() to restore the directory. On failure, returns an empty string. - Example: > + Example: >vim let save_dir = chdir(newdir) if save_dir != "" " ... do some work call chdir(save_dir) endif - <Can also be used as a |method|: > + <Can also be used as a |method|: >vim GetDir()->chdir() < ]=], @@ -1325,8 +1323,9 @@ M.funcs = { When {lnum} is invalid -1 is returned. See |C-indenting|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetLnum()->cindent() + < ]=], name = 'cindent', params = { { 'lnum', 'integer' } }, @@ -1342,7 +1341,7 @@ M.funcs = { If {win} is specified, use the window with this number or window ID instead of the current window. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetWin()->clearmatches() < ]=], @@ -1377,11 +1376,11 @@ M.funcs = { For the screen column position use |virtcol()|. For the character position use |charcol()|. Note that only marks in the current file can be used. - Examples: > - col(".") column of cursor - col("$") length of cursor line plus one - col("'t") column of mark t - col("'" .. markname) column of mark markname + Examples: >vim + echo col(".") " column of cursor + echo col("$") " length of cursor line plus one + echo col("'t") " column of mark t + echo col("'" .. markname) " column of mark markname <The first column is 1. Returns 0 if {expr} is invalid or when the window with ID {winid} is not found. For an uppercase mark the column may actually be in another @@ -1389,13 +1388,12 @@ M.funcs = { For the cursor position, when 'virtualedit' is active, the column is one higher if the cursor is after the end of the line. Also, when using a <Cmd> mapping the cursor isn't - moved, this can be used to obtain the column in Insert mode: > - :imap <F2> <Cmd>echo col(".").."\n"<CR> + moved, this can be used to obtain the column in Insert mode: >vim + imap <F2> <Cmd>echo col(".").."\n"<CR> - <Can also be used as a |method|: > + <Can also be used as a |method|: >vim GetPos()->col() < - ]=], name = 'col', params = { { 'expr', 'any' }, { 'winid', 'integer' } }, @@ -1423,7 +1421,7 @@ M.funcs = { The match can be selected with CTRL-N and CTRL-P as usual with Insert mode completion. The popup menu will appear if specified, see |ins-completion-menu|. - Example: > + Example: >vim inoremap <F5> <C-R>=ListMonths()<CR> func ListMonths() @@ -1436,9 +1434,9 @@ M.funcs = { an empty string is returned to avoid a zero being inserted. Can also be used as a |method|, the base is passed as the - second argument: > + second argument: >vim GetMatches()->complete(col('.')) - + < ]=], name = 'complete', params = { { 'startcol', 'any' }, { 'matches', 'any' } }, @@ -1458,9 +1456,9 @@ M.funcs = { See |complete-functions| for an explanation of {expr}. It is the same as one item in the list that 'omnifunc' would return. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetMoreMatches()->complete_add() - + < ]=], name = 'complete_add', params = { { 'expr', 'any' } }, @@ -1534,7 +1532,7 @@ M.funcs = { Returns an empty |Dictionary| on error. - Examples: > + Examples: >vim " Get all items call complete_info() " Get only 'mode' @@ -1542,7 +1540,7 @@ M.funcs = { " Get only 'mode' and 'pum_visible' call complete_info(['mode', 'pum_visible']) - <Can also be used as a |method|: > + <Can also be used as a |method|: >vim GetItems()->complete_info() < ]=], @@ -1566,11 +1564,11 @@ M.funcs = { some systems the string is wrapped when it doesn't fit. {choices} is a String, with the individual choices separated - by '\n', e.g. > + by '\n', e.g. >vim confirm("Save changes?", "&Yes\n&No\n&Cancel") <The letter after the '&' is the shortcut key for that choice. Thus you can type 'c' to select "Cancel". The shortcut does - not need to be the first letter: > + not need to be the first letter: >vim confirm("file has been modified", "&Save\nSave &All") <For the console, the first letter of each choice is used as the default shortcut key. Case is ignored. @@ -1589,7 +1587,7 @@ M.funcs = { If the user aborts the dialog by pressing <Esc>, CTRL-C, or another valid interrupt key, confirm() returns 0. - An example: > + An example: >vim let choice = confirm("What do you want?", \ "&Apples\n&Oranges\n&Bananas", 2) if choice == 0 @@ -1606,7 +1604,7 @@ M.funcs = { don't fit, a vertical layout is used anyway. For some systems the horizontal layout is always used. - Can also be used as a |method|in: > + Can also be used as a |method|in: >vim BuildMessage()->confirm("&Yes\n&No") < ]=], @@ -1627,8 +1625,9 @@ M.funcs = { changing an item changes the contents of both |Lists|. A |Dictionary| is copied in a similar way as a |List|. Also see |deepcopy()|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim mylist->copy() + < ]=], name = 'copy', params = { { 'expr', 'any' } }, @@ -1642,14 +1641,15 @@ M.funcs = { Return the cosine of {expr}, measured in 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 cos(100) - < 0.862319 > - :echo cos(-4.01) + Examples: >vim + echo cos(100) + < 0.862319 >vim + echo cos(-4.01) < -0.646043 - Can also be used as a |method|: > + Can also be used as a |method|: >vim Compute()->cos() + < ]=], float_func = 'cos', name = 'cos', @@ -1665,15 +1665,15 @@ M.funcs = { [1, inf]. {expr} must evaluate to a |Float| or a |Number|. Returns 0.0 if {expr} is not a |Float| or a |Number|. - Examples: > - :echo cosh(0.5) - < 1.127626 > - :echo cosh(-0.5) + Examples: >vim + echo cosh(0.5) + < 1.127626 >vim + echo cosh(-0.5) < -1.127626 - Can also be used as a |method|: > + Can also be used as a |method|: >vim Compute()->cosh() - + < ]=], float_func = 'cosh', name = 'cosh', @@ -1697,7 +1697,7 @@ M.funcs = { occurrences of {expr} is returned. Zero is returned when {expr} is an empty string. - Can also be used as a |method|: > + Can also be used as a |method|: >vim mylist->count(val) < ]=], @@ -1735,7 +1735,6 @@ M.funcs = { If {types} is given and is a |List| of |String|s, it specifies which |context-types| to include in the pushed context. Otherwise, all context types are included. - ]=], name = 'ctxpush', params = { { 'types', 'any' } }, @@ -1748,7 +1747,6 @@ M.funcs = { |context-stack| to that represented by {context}. {context} is a Dictionary with context data (|context-dict|). If {index} is not given, it is assumed to be 0 (i.e.: top). - ]=], name = 'ctxset', params = { { 'context', 'any' }, { 'index', 'any' } }, @@ -1757,7 +1755,6 @@ M.funcs = { ctxsize = { desc = [=[ Returns the size of the |context-stack|. - ]=], name = 'ctxsize', params = {}, @@ -1805,9 +1802,9 @@ M.funcs = { position within a <Tab> or after the last character. Returns 0 when the position could be set, -1 otherwise. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetCursorPos()->cursor() - + < ]=], name = 'cursor', params = { { 'list', 'any' } }, @@ -1825,7 +1822,7 @@ M.funcs = { Returns |TRUE| if successfully interrupted the program. Otherwise returns |FALSE|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetPid()->debugbreak() < ]=], @@ -1857,9 +1854,9 @@ M.funcs = { {noref} set to 1 will fail. Also see |copy()|. - Can also be used as a |method|: > + Can also be used as a |method|: >vim GetObject()->deepcopy() - |