From 4efcb72bb758ce93e86fa3ef520e009d01d4891b Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 31 Oct 2021 16:41:39 +0000 Subject: feat(eval/method): partially port v8.1.1993 Problem: More functions can be used as methods. Solution: Make various functions usable as a method. https://github.com/vim/vim/commit/196b4664432f932625cfb6371dc42c24efe6c203 server2client requires +clientserver, which hasn't been ported yet. The eval.txt docs and test_clientserver.vim tests for server2client already exist, so include those changes. test_bufline.vim: Test for setbufline requires v8.1.1189 (which was reverted in #10848). --- runtime/doc/eval.txt | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 02ff9fc591..74b0351dbe 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5854,7 +5854,7 @@ histadd({history}, {item}) *histadd()* Can also be used as a |method|, the base is used for the second argument: > - GetPattern()->histadd('search') + GetHistory()->histadd('search') histdel({history} [, {item}]) *histdel()* Clear {history}, i.e. delete all its entries. See |hist-names| @@ -8072,6 +8072,9 @@ screenattr({row}, {col}) *screenattr()* arbitrary number that can only be used to compare to the attribute at other positions. + Can also be used as a |method|: > + GetRow()->screenattr(col) + screenchar({row}, {col}) *screenchar()* The result is a Number, which is the character at position [row, col] on the screen. This works for every possible @@ -8082,6 +8085,9 @@ screenchar({row}, {col}) *screenchar()* This is mainly to be used for testing. Returns -1 when row or col is out of range. + Can also be used as a |method|: > + GetRow()->screenchar(col) + screenchars({row}, {col}) *screenchars()* The result is a List of Numbers. The first number is the same as what |screenchar()| returns. Further numbers are @@ -8089,6 +8095,9 @@ screenchars({row}, {col}) *screenchars()* This is mainly to be used for testing. Returns an empty List when row or col is out of range. + Can also be used as a |method|: > + GetRow()->screenchars(col) + screencol() *screencol()* The result is a Number, which is the current screen column of the cursor. The leftmost column has number 1. @@ -8124,6 +8133,9 @@ screenpos({winid}, {lnum}, {col}) *screenpos()* right position and use |screencol()| to get the value with |conceal| taken into account. + Can also be used as a |method|: > + GetWinid()->screenpos(lnum, col) + screenrow() *screenrow()* The result is a Number, which is the current screen row of the cursor. The top line has number one. @@ -8140,6 +8152,9 @@ screenstring({row}, {col}) *screenstring()* This is mainly to be used for testing. Returns an empty String when row or col is out of range. + Can also be used as a |method|: > + GetRow()->screenstring(col) + search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* Search for regexp pattern {pattern}. The search starts at the cursor position (you can use |cursor()| to set it). @@ -8230,6 +8245,8 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* without the 'e' flag if the cursor is on the "f" of "if". The 'n' flag tells the function not to move the cursor. + Can also be used as a |method|: > + GetPattern()->search() searchcount([{options}]) *searchcount()* Get or update the last search count, like what is displayed @@ -8368,6 +8385,9 @@ searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()* if searchdecl('myvar') == 0 echo getline('.') endif +< + Can also be used as a |method|: > + GetName()->searchdecl() < *searchpair()* searchpair({start}, {middle}, {end} [, {flags} [, {skip} @@ -8483,6 +8503,9 @@ searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *searchpos()* < In this example "submatch" is 2 when a lowercase letter is found |/\l|, 3 when an uppercase letter is found |/\u|. + Can also be used as a |method|: > + GetPattern()->searchpos() + server2client({clientid}, {string}) *server2client()* Send a reply string to {clientid}. The most recent {clientid} that sent a string can be retrieved with expand(""). @@ -8494,6 +8517,9 @@ server2client({clientid}, {string}) *server2client()* See also |clientserver|. Example: > :echo server2client(expand(""), "HELLO") + +< Can also be used as a |method|: > + GetClientId()->server2client(string) < serverlist() *serverlist()* Returns a list of server addresses, or empty if all servers @@ -8559,6 +8585,9 @@ setbufline({buf}, {lnum}, {text}) *setbufline()* If {buf} is not a valid buffer or {lnum} is not valid, an error message is given. + Can also be used as a |method|: > + GetText()->setbufline(buf, lnum) + setbufvar({buf}, {varname}, {val}) *setbufvar()* Set option or local variable {varname} in buffer {buf} to {val}. @@ -8573,6 +8602,9 @@ setbufvar({buf}, {varname}, {val}) *setbufvar()* :call setbufvar("todo", "myvar", "foobar") < This function is not available in the |sandbox|. + Can also be used as a |method|: > + GetValue()->setbufvar(buf, varname) + setcharsearch({dict}) *setcharsearch()* Set the current character search information to {dict}, which contains one or more of the following entries: @@ -8593,6 +8625,9 @@ setcharsearch({dict}) *setcharsearch()* :call setcharsearch(prevsearch) < Also see |getcharsearch()|. + Can also be used as a |method|: > + SavedSearch()->setcharsearch() + setcmdpos({pos}) *setcmdpos()* Set the cursor position in the command line to byte position {pos}. The first position is 1. @@ -8608,6 +8643,9 @@ setcmdpos({pos}) *setcmdpos()* Returns FALSE when successful, TRUE when not editing the command line. + Can also be used as a |method|: > + GetPos()->setcmdpos() + setenv({name}, {val}) *setenv()* Set environment variable {name} to {val}. Example: > call setenv('HOME', '/home/myhome') @@ -8615,6 +8653,9 @@ setenv({name}, {val}) *setenv()* < When {val} is |v:null| the environment variable is deleted. See also |expr-env|. + Can also be used as a |method|, passing the value as the base: > + GetPath()->setenv('PATH') + setfperm({fname}, {mode}) *setfperm()* *chmod* Set the file permissions for {fname} to {mode}. {mode} must be a string with 9 characters. It is of the form @@ -8660,6 +8701,9 @@ setline({lnum}, {text}) *setline()* < Note: The '[ and '] marks are not set. + Can also be used as a |method|, passing the text as the base: > + GetText()->setline(lnum) + setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()* Create or replace or add to the location list for window {nr}. {nr} can be the window number or the |window-ID|. -- cgit From aad25ae4fc3fdfdf2c23009406cf3f806a2c272d Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 31 Oct 2021 17:31:35 +0000 Subject: vim-patch:8.1.1995: more functions can be used as methods Problem: More functions can be used as methods. Solution: Make sign functions usable as a method. https://github.com/vim/vim/commit/93476fd6343ef40d088e064289cc279659d03953 Make sign_placelist and sign_unplacelist accept exactly one argument. Before, they erroneously accepted one or more arguments. --- runtime/doc/sign.txt | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 5079d900c9..9181684945 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -404,6 +404,9 @@ sign_define({list}) \ 'text' : '!!'} \ ]) < + Can also be used as a |method|: > + GetSignList()->sign_define() + sign_getdefined([{name}]) *sign_getdefined()* Get a list of defined signs and their attributes. This is similar to the |:sign-list| command. @@ -435,6 +438,9 @@ sign_getdefined([{name}]) *sign_getdefined()* " Get the attribute of the sign named mySign echo sign_getdefined("mySign") < + Can also be used as a |method|: > + GetSignList()->sign_getdefined() + sign_getplaced([{buf} [, {dict}]]) *sign_getplaced()* Return a list of signs placed in a buffer or all the buffers. This is similar to the |:sign-place-list| command. @@ -494,6 +500,9 @@ sign_getplaced([{buf} [, {dict}]]) *sign_getplaced()* " Get a List of all the placed signs echo sign_getplaced() +< + Can also be used as a |method|: > + GetBufname()->sign_getplaced() < *sign_jump()* sign_jump({id}, {group}, {buf}) @@ -510,7 +519,9 @@ sign_jump({id}, {group}, {buf}) " Jump to sign 10 in the current buffer call sign_jump(10, '', '') < - + Can also be used as a |method|: > + GetSignid()->sign_jump() +< *sign_place()* sign_place({id}, {group}, {name}, {buf} [, {dict}]) Place the sign defined as {name} at line {lnum} in file or @@ -560,7 +571,9 @@ sign_place({id}, {group}, {name}, {buf} [, {dict}]) call sign_place(10, 'g3', 'sign4', 'json.c', \ {'lnum' : 40, 'priority' : 90}) < - + Can also be used as a |method|: > + GetSignid()->sign_place(group, name, expr) +< *sign_placelist()* sign_placelist({list}) Place one or more signs. This is similar to the @@ -620,6 +633,8 @@ sign_placelist({list}) \ 'lnum' : 50} \ ]) < + Can also be used as a |method|: > + GetSignlist()->sign_placelist() sign_undefine([{name}]) *sign_undefine()* sign_undefine({list}) @@ -644,6 +659,8 @@ sign_undefine({list}) " Delete all the signs call sign_undefine() < + Can also be used as a |method|: > + GetSignlist()->sign_undefine() sign_unplace({group} [, {dict}]) *sign_unplace()* Remove a previously placed sign in one or more buffers. This @@ -686,6 +703,9 @@ sign_unplace({group} [, {dict}]) *sign_unplace()* " Remove all the placed signs from all the buffers call sign_unplace('*') + +< Can also be used as a |method|: > + GetSigngroup()->sign_unplace() < sign_unplacelist({list}) *sign_unplacelist()* Remove previously placed signs from one or more buffers. This @@ -715,5 +735,8 @@ sign_unplacelist({list}) *sign_unplacelist()* \ {'id' : 20, 'buffer' : 'b.vim'}, \ ]) < + Can also be used as a |method|: > + GetSignlist()->sign_unplacelist() +< vim:tw=78:ts=8:noet:ft=help:norl: -- cgit From 2ee0bc09d9becd71ca864b4d754b63b152d1ce5b Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 31 Oct 2021 18:10:46 +0000 Subject: feat(eval/method): partially port v8.1.1996 Problem: More functions can be used as methods. Solution: Make various functions usable as a method. https://github.com/vim/vim/commit/aad222c9c9a1e4fe6ae5a1fe95bb084619be0e65 Partial port as this does not include eval.txt change for listener_add. Cherry-pick eval.txt changes for: - bufadd from v8.1.1626: https://github.com/vim/vim/commit/5ca1ac373ae62b37152cb6f85916b402eda520a5 - setloclist and setqflist headers from: https://github.com/vim/vim/commit/b0d45e7f5354375edd02afafde3bd37dac1515ff Correct eval.txt typo for settabwinvar method call (matches latest Vim). --- runtime/doc/eval.txt | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 74b0351dbe..bbd3226d4c 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2992,7 +2992,11 @@ bufadd({name}) *bufadd()* 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. + 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']) < Can also be used as a |method|: > let bufnr = 'somename'->bufadd() @@ -8704,7 +8708,7 @@ setline({lnum}, {text}) *setline()* Can also be used as a |method|, passing the text as the base: > GetText()->setline(lnum) -setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()* +setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()* Create or replace or add to the location list for window {nr}. {nr} can be the window number or the |window-ID|. When {nr} is zero the current window is used. @@ -8720,6 +8724,10 @@ setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()* only the items listed in {what} are set. Refer to |setqflist()| for the list of supported keys in {what}. + Can also be used as a |method|, the base is passed as the + second argument: > + GetLoclist()->setloclist(winnr) + setmatches({list} [, {win}]) *setmatches()* Restores a list of matches saved by |getmatches() for the current window|. Returns 0 if successful, otherwise -1. All @@ -8728,6 +8736,9 @@ setmatches({list} [, {win}]) *setmatches()* 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|: > + GetMatches()->setmatches() +< *setpos()* setpos({expr}, {list}) Set the position for String {expr}. Possible values: @@ -8777,8 +8788,10 @@ setpos({expr}, {list}) also set the preferred column. Also see the "curswant" key in |winrestview()|. + Can also be used as a |method|: > + GetPosition()->setpos('.') -setqflist({list} [, {action}[, {what}]]) *setqflist()* +setqflist({list} [, {action} [, {what}]]) *setqflist()* Create or replace or add to the quickfix list. If the optional {what} dictionary argument is supplied, then @@ -8887,7 +8900,10 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()* independent of the 'errorformat' setting. Use a command like `:cc 1` to jump to the first position. - + Can also be used as a |method|, the base is passed as the + second argument: > + GetErrorlist()->setqflist() +< *setreg()* setreg({regname}, {value} [, {options}]) Set the register {regname} to {value}. @@ -8944,6 +8960,10 @@ setreg({regname}, {value} [, {options}]) nothing: > :call setreg('a', '', 'al') +< Can also be used as a |method|, the base is passed as the + second argument: > + GetText()->setreg('a') + settabvar({tabnr}, {varname}, {val}) *settabvar()* Set tab-local variable {varname} to {val} in tab page {tabnr}. |t:var| @@ -8952,6 +8972,9 @@ settabvar({tabnr}, {varname}, {val}) *settabvar()* Tabs are numbered starting with one. This function is not available in the |sandbox|. + Can also be used as a |method|, the base is used as the value: > + GetValue()->settabvar(tab, name) + settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* Set option or local variable {varname} in window {winnr} to {val}. @@ -8968,6 +8991,9 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* :call settabwinvar(3, 2, "myvar", "foobar") < This function is not available in the |sandbox|. + Can also be used as a |method|, the base is used as the value: > + GetValue()->settabwinvar(tab, winnr, name) + settagstack({nr}, {dict} [, {action}]) *settagstack()* Modify the tag stack of the window {nr} using {dict}. {nr} can be the window number or the |window-ID|. @@ -9001,6 +9027,8 @@ settagstack({nr}, {dict} [, {action}]) *settagstack()* call settagstack(1003, stack) unlet stack < + Can also be used as a |method|, the base is used as the Dict: > + GetStack()->settagstack(winnr) setwinvar({nr}, {varname}, {val}) *setwinvar()* Like |settabwinvar()| for the current tab page. @@ -9008,10 +9036,16 @@ setwinvar({nr}, {varname}, {val}) *setwinvar()* :call setwinvar(1, "&list", 0) :call setwinvar(2, "myvar", "foobar") +< Can also be used as a |method|, the base is used as the value: > + GetValue()->setwinvar(winnr, name) + sha256({string}) *sha256()* Returns a String with 64 hex characters, which is the SHA256 checksum of {string}. + Can also be used as a |method|: > + GetText()->sha256() + shellescape({string} [, {special}]) *shellescape()* Escape {string} for use as a shell command argument. @@ -9043,6 +9077,8 @@ shellescape({string} [, {special}]) *shellescape()* :call system("chmod +w -- " . shellescape(expand("%"))) < See also |::S|. + Can also be used as a |method|: > + GetCommand()->shellescape() shiftwidth([{col}]) *shiftwidth()* Returns the effective value of 'shiftwidth'. This is the @@ -9065,6 +9101,9 @@ shiftwidth([{col}]) *shiftwidth()* 'vartabstop' feature. If no {col} argument is given, column 1 will be assumed. + Can also be used as a |method|: > + GetColumn()->shiftwidth() + sign_ functions are documented here: |sign-functions-details| simplify({filename}) *simplify()* -- cgit From 0f4510cb1a48c4c4d7b23a45f57d087329d4364d Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 31 Oct 2021 19:04:28 +0000 Subject: feat(eval/method): partially port v8.1.2004 Problem: More functions can be used as methods. Solution: Make various functions usable as a method. https://github.com/vim/vim/commit/f6ed61e1489e40eada55a4f1782e1ed82bcad7d9 +sound is needed for sound_* functions. Make swapinfo and swapname take exactly one argument. Previously, they could erroneously take one or more. --- runtime/doc/eval.txt | 59 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 8 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index bbd3226d4c..fcaed24b1f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -9254,6 +9254,9 @@ soundfold({word}) This can be used for making spelling suggestions. Note that the method can be quite slow. + Can also be used as a |method|: > + GetWord()->soundfold() +< *spellbadword()* spellbadword([{sentence}]) Without argument: The result is the badly spelled word under @@ -9279,6 +9282,9 @@ spellbadword([{sentence}]) The spelling information for the current window and the value of 'spelllang' are used. + Can also be used as a |method|: > + GetText()->spellbadword() +< *spellsuggest()* spellsuggest({word} [, {max} [, {capital}]]) Return a |List| with spelling suggestions to replace {word}. @@ -9301,6 +9307,8 @@ spellsuggest({word} [, {max} [, {capital}]]) The spelling information for the current window is used. The values of 'spelllang' and 'spellsuggest' are used. + Can also be used as a |method|: > + GetWord()->spellsuggest() split({string} [, {pattern} [, {keepempty}]]) *split()* Make a |List| out of {string}. When {pattern} is omitted or @@ -9432,6 +9440,20 @@ str2nr({string} [, {base}]) *str2nr()* {base} is 2 a leading "0b" or "0B" is ignored. Text after the number is silently ignored. + Can also be used as a |method|: > + GetText()->str2nr() + +strcharpart({src}, {start} [, {len}]) *strcharpart()* + Like |strpart()| but using character index and length instead + of byte index and length. Composing characters are counted + separately. + When a character index is used where a character does not + exist it is assumed to be one character. For example: > + strcharpart('abc', -1, 2) +< results in 'a'. + + Can also be used as a |method|: > + GetText()->strcharpart(5) strchars({string} [, {skipcc}]) *strchars()* The result is a Number, which is the number of characters @@ -9457,14 +9479,8 @@ strchars({string} [, {skipcc}]) *strchars()* endfunction endif < -strcharpart({src}, {start} [, {len}]) *strcharpart()* - Like |strpart()| but using character index and length instead - of byte index and length. Composing characters are counted - separately. - When a character index is used where a character does not - exist it is assumed to be one character. For example: > - strcharpart('abc', -1, 2) -< results in 'a'. + Can also be used as a |method|: > + GetText()->strchars() strdisplaywidth({string} [, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells @@ -9479,6 +9495,9 @@ strdisplaywidth({string} [, {col}]) *strdisplaywidth()* Ambiguous, this function's return value depends on 'ambiwidth'. Also see |strlen()|, |strwidth()| and |strchars()|. + Can also be used as a |method|: > + GetText()->strdisplaywidth() + strftime({format} [, {time}]) *strftime()* The result is a String, which is a formatted date and time, as specified by the {format} string. The given {time} is used, @@ -9496,12 +9515,18 @@ strftime({format} [, {time}]) *strftime()* :echo strftime("%c", getftime("file.c")) Show mod time of file.c. +< Can also be used as a |method|: > + GetFormat()->strftime() + strgetchar({str}, {index}) *strgetchar()* Get character {index} from {str}. This uses a character index, not a byte index. Composing characters are considered separate characters here. Also see |strcharpart()| and |strchars()|. + Can also be used as a |method|: > + GetText()->strgetchar(5) + stridx({haystack}, {needle} [, {start}]) *stridx()* The result is a Number, which gives the byte index in {haystack} of the first occurrence of the String {needle}. @@ -9521,6 +9546,9 @@ stridx({haystack}, {needle} [, {start}]) *stridx()* stridx() works similar to the C function strstr(). When used with a single character it works similar to strchr(). + Can also be used as a |method|: > + GetHaystack()->stridx(needle) + *string()* string({expr}) Return {expr} converted to a String. If {expr} is a Number, Float, String, Blob or a composition of them, then the result @@ -9583,6 +9611,9 @@ strpart({src}, {start} [, {len} [, {chars}]]) *strpart()* example, to get the character under the cursor: > strpart(getline("."), col(".") - 1, 1, v:true) < + Can also be used as a |method|: > + GetText()->strpart(5) + strptime({format}, {timestring}) *strptime()* The result is a Number, which is a unix timestamp representing the date and time in {timestring}, which is expected to match @@ -9626,6 +9657,9 @@ strridx({haystack}, {needle} [, {start}]) *strridx()* When used with a single character it works similar to the C function strrchr(). + Can also be used as a |method|: > + GetHaystack()->strridx(needle) + strtrans({string}) *strtrans()* The result is a String, which is {string} with all unprintable characters translated into printable characters |'isprint'|. @@ -9674,6 +9708,9 @@ submatch({nr} [, {list}]) *submatch()* *E935* < This finds the first number in the line and adds one to it. A line break is included as a newline character. + Can also be used as a |method|: > + GetNr()->submatch() + substitute({string}, {pat}, {sub}, {flags}) *substitute()* The result is a String, which is a copy of {string}, in which the first match of {pat} is replaced with {sub}. @@ -9736,6 +9773,9 @@ swapinfo({fname}) *swapinfo()* Not a swap file: does not contain correct block ID Magic number mismatch: Info in first block is invalid + Can also be used as a |method|: > + GetFilename()->swapinfo() + swapname({buf}) *swapname()* The result is the swap file path of the buffer {buf}. For the use of {buf}, see |bufname()| above. @@ -9743,6 +9783,9 @@ swapname({buf}) *swapname()* |:swapname| (unless there is no swap file). If buffer {buf} has no swap file, returns an empty string. + Can also be used as a |method|: > + GetBufname()->swapname() + synID({lnum}, {col}, {trans}) *synID()* The result is a Number, which is the syntax ID at the position {lnum} and {col} in the current window. -- cgit From 39776d1a6513e33a33addb69deae72ab2ecafef4 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 1 Nov 2021 00:28:00 +0000 Subject: vim-patch:8.1.2011: more functions can be used as methods Problem: More functions can be used as methods. Solution: Make various functions usable as a method. Make the window command test faster. https://github.com/vim/vim/commit/ce90e36f5969e733a0a919f1736453332c33aad6 test_* functions in the patch are N/A as they modify internal state. Include test changes for test_ignore_error and test_feedinput (though they aren't run). Other changed tests were excluded from previous patches, except test_termcodes.vim, which hasn't been ported yet. --- runtime/doc/eval.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index fcaed24b1f..758c93231d 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -9982,6 +9982,8 @@ tabpagebuflist([{arg}]) *tabpagebuflist()* endfor < Note that a buffer may appear in more than one window. + Can also be used as a |method|: > + GetTabpage()->tabpagebuflist() tabpagenr([{arg}]) *tabpagenr()* The result is a Number, which is the number of the current @@ -10008,6 +10010,9 @@ tabpagewinnr({tabarg} [, {arg}]) *tabpagewinnr()* tabpagewinnr(4, '$') " number of windows in tab page 4 < When {tabarg} is invalid zero is returned. + Can also be used as a |method|: > + GetTabpage()->tabpagewinnr() +< *tagfiles()* tagfiles() Returns a |List| with the file names used to search for tags for the current buffer. This is the 'tags' option expanded. @@ -10056,6 +10061,9 @@ taglist({expr} [, {filename}]) *taglist()* located by Vim. Refer to |tags-file-format| for the format of the tags file generated by the different ctags tools. + Can also be used as a |method|: > + GetTagpattern()->taglist() + tempname() *tempname()* *temp-file-name* The result is a String, which is the name of a file that doesn't exist. It can be used for a temporary file. Example: > -- cgit From 38a831e54a7261fda06555bc7464546ecfcbf897 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 1 Nov 2021 16:21:16 +0000 Subject: vim-patch:7.4.1777 Problem: Newly added features can escape the sandbox. Solution: Add checks for restricted and secure. (Yasuhiro Matsumoto) https://github.com/vim/vim/commit/3849992b16011e36a5cb5be4b127f843389b96fd timer_start is missing check_secure. The timer callback can, for example, call a function defined from outside the sandbox that does stuff that would be disallowed from inside the sandbox. This is usually not allowed. Cherry-pick eval.txt change from: https://github.com/vim/vim/commit/68e6560b84f196c82e27a72669684d5506a3a837 Required for v8.1.2013. --- runtime/doc/eval.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 758c93231d..234879218e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -10171,6 +10171,8 @@ timer_start({time}, {callback} [, {options}]) \ {'repeat': 3}) < This invokes MyHandler() three times at 500 msec intervals. + Not available in the |sandbox|. + timer_stop({timer}) *timer_stop()* Stop a timer. The timer callback will no longer be invoked. {timer} is an ID returned by timer_start(), thus it must be a -- cgit From 2ad92e947650cc502952b3ec23a23f9862f3a76d Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 1 Nov 2021 16:26:19 +0000 Subject: vim-patch:8.1.2013: more functions can be used as methods Problem: More functions can be used as methods. Solution: Make various functions usable as a method. https://github.com/vim/vim/commit/f92e58cadb03156879e9bdbf6341bf662d9c87cc Cherry-pick s:normalize_fname for tolower test from v8.1.0894 and v8.1.1417 (even though it is unused for now). Fix header for win_id2tabwin in eval.txt. --- runtime/doc/eval.txt | 75 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 234879218e..632329a65e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -10131,6 +10131,9 @@ timer_info([{id}]) -1 means forever "callback" the callback + Can also be used as a |method|: > + GetTimer()->timer_info() +< timer_pause({timer}, {paused}) *timer_pause()* Pause or unpause a timer. A paused timer does not invoke its callback when its time expires. Unpausing a timer may cause @@ -10144,6 +10147,9 @@ timer_pause({timer}, {paused}) *timer_pause()* String, then the timer is paused, otherwise it is unpaused. See |non-zero-arg|. + Can also be used as a |method|: > + GetTimer()->timer_pause(1) +< *timer_start()* *timer* *timers* timer_start({time}, {callback} [, {options}]) Create a timer and return the timer ID. @@ -10171,13 +10177,19 @@ timer_start({time}, {callback} [, {options}]) \ {'repeat': 3}) < This invokes MyHandler() three times at 500 msec intervals. - Not available in the |sandbox|. + Can also be used as a |method|: > + GetMsec()->timer_start(callback) + +< Not available in the |sandbox|. timer_stop({timer}) *timer_stop()* Stop a timer. The timer callback will no longer be invoked. {timer} is an ID returned by timer_start(), thus it must be a Number. If {timer} does not exist there is no error. + Can also be used as a |method|: > + GetTimer()->timer_stop() +< timer_stopall() *timer_stopall()* Stop all timers. The timer callbacks will no longer be invoked. Useful if some timers is misbehaving. If there are @@ -10188,11 +10200,17 @@ tolower({expr}) *tolower()* characters turned into lowercase (just like applying |gu| to the string). + Can also be used as a |method|: > + GetText()->tolower() + toupper({expr}) *toupper()* The result is a copy of the String given, with all lowercase characters turned into uppercase (just like applying |gU| to the string). + Can also be used as a |method|: > + GetText()->toupper() + tr({src}, {fromstr}, {tostr}) *tr()* The result is a copy of the {src} string with all characters which appear in {fromstr} replaced by the character in that @@ -10207,6 +10225,9 @@ tr({src}, {fromstr}, {tostr}) *tr()* echo tr("", "<>", "{}") < returns "{blob}" + Can also be used as a |method|: > + GetText()->tr(from, to) + trim({text} [, {mask} [, {dir}]]) *trim()* Return {text} as a String where any character in {mask} is removed from the beginning and/or end of {text}. @@ -10230,6 +10251,9 @@ trim({text} [, {mask} [, {dir}]]) *trim()* echo trim(" vim ", " ", 2) < returns " vim" + Can also be used as a |method|: > + GetText()->trim() + trunc({expr}) *trunc()* Return the largest integral value with magnitude less than or equal to {expr} as a |Float| (truncate towards zero). @@ -10286,6 +10310,9 @@ undofile({name}) *undofile()* buffer without a file name will not write an undo file. Useful in combination with |:wundo| and |:rundo|. + Can also be used as a |method|: > + GetFilename()->undofile() + undotree() *undotree()* Return the current state of the undo tree in a dictionary with the following items: @@ -10384,8 +10411,10 @@ virtcol({expr}) *virtcol()* all lines: > echo max(map(range(1, line('$')), "virtcol([v:val, '$'])")) +< Can also be used as a |method|: > + GetPos()->virtcol() -visualmode([expr]) *visualmode()* +visualmode([{expr}]) *visualmode()* The result is a String, which describes the last Visual mode used in the current buffer. Initially it returns an empty string, but once Visual mode has been used, it returns "v", @@ -10399,7 +10428,7 @@ visualmode([expr]) *visualmode()* Visual mode that was used. If Visual mode is active, use |mode()| to get the Visual mode (e.g., in a |:vmap|). - If [expr] is supplied and it evaluates to a non-zero Number or + If {expr} is supplied and it evaluates to a non-zero Number or a non-empty String, then the Visual mode will be cleared and the old value is returned. See |non-zero-arg|. @@ -10438,11 +10467,18 @@ win_execute({id}, {command} [, {silent}]) *win_execute()* have unexpected side effects. Use |:noautocmd| if needed. Example: > call win_execute(winid, 'syntax enable') +< + Can also be used as a |method|, the base is used for the + command: > + GetCommand()->win_execute(winid) win_findbuf({bufnr}) *win_findbuf()* Returns a |List| with |window-ID|s for windows that contain buffer {bufnr}. When there is none the list is empty. + Can also be used as a |method|: > + GetBufnr()->win_findbuf() + win_getid([{win} [, {tab}]]) *win_getid()* Get the |window-ID| for the specified window. When {win} is missing use the current window. @@ -10452,6 +10488,9 @@ win_getid([{win} [, {tab}]]) *win_getid()* number {tab}. The first tab has number one. Return zero if the window cannot be found. + Can also be used as a |method|: > + GetWinnr()->win_getid() + win_gettype([{nr}]) *win_gettype()* Return the type of the window: "autocmd" autocommand window. Temporary window @@ -10477,15 +10516,24 @@ win_gotoid({expr}) *win_gotoid()* tabpage. Return TRUE if successful, FALSE if the window cannot be found. -win_id2tabwin({expr} *win_id2tabwin()* + Can also be used as a |method|: > + GetWinid()->win_gotoid() + +win_id2tabwin({expr}) *win_id2tabwin()* Return a list with the tab number and window number of window with ID {expr}: [tabnr, winnr]. Return [0, 0] if the window cannot be found. + Can also be used as a |method|: > + GetWinid()->win_id2tabwin() + win_id2win({expr}) *win_id2win()* Return the window number of window with ID {expr}. Return 0 if the window cannot be found in the current tabpage. + Can also be used as a |method|: > + GetWinid()->win_id2win() + win_screenpos({nr}) *win_screenpos()* Return the screen position of window {nr} as a list with two numbers: [row, col]. The first window always has position @@ -10495,6 +10543,9 @@ win_screenpos({nr}) *win_screenpos()* Returns [0, 0] if the window cannot be found in the current tabpage. + Can also be used as a |method|: > + GetWinid()->win_screenpos() +< win_splitmove({nr}, {target} [, {options}]) *win_splitmove()* Move the window {nr} to a new split of the window {target}. This is similar to moving to {target}, creating a new window @@ -10549,6 +10600,9 @@ winheight({nr}) *winheight()* This excludes any window toolbar line. Examples: > :echo "The current window has " . winheight(0) . " lines." + +< Can also be used as a |method|: > + GetWinid()->winheight() < winlayout([{tabnr}]) *winlayout()* The result is a nested List containing the layout of windows @@ -10579,6 +10633,9 @@ winlayout([{tabnr}]) *winlayout()* :echo winlayout(2) ['col', [['leaf', 1002], ['row', [['leaf', 1003], ['leaf', 1001]]], ['leaf', 1000]]] +< + Can also be used as a |method|: > + GetTabnr()->winlayout() < *winline()* winline() The result is a Number, which is the screen line of the cursor @@ -10614,6 +10671,9 @@ winnr([{arg}]) The result is a Number, which is the number of the current let window_count = winnr('$') let prev_window = winnr('#') let wnum = winnr('3k') + +< Can also be used as a |method|: > + GetWinval()->winnr() < *winrestcmd()* winrestcmd() Returns a sequence of |:resize| commands that should restore @@ -10642,6 +10702,9 @@ winrestview({dict}) If you have changed the values the result is unpredictable. If the window size changed the result won't be the same. + Can also be used as a |method|: > + GetView()->winrestview() +< *winsaveview()* winsaveview() Returns a |Dictionary| that contains information to restore the view of the current window. Use |winrestview()| to @@ -10680,6 +10743,8 @@ winwidth({nr}) *winwidth()* < For getting the terminal or screen size, see the 'columns' option. + Can also be used as a |method|: > + GetWinid()->winwidth() wordcount() *wordcount()* The result is a dictionary of byte/chars/word statistics for @@ -10738,6 +10803,8 @@ writefile({object}, {fname} [, {flags}]) :let fl = readfile("foo", "b") :call writefile(fl, "foocopy", "b") +< Can also be used as a |method|: > + GetText()->writefile("thefile") xor({expr}, {expr}) *xor()* Bitwise XOR on the two arguments. The arguments are converted -- cgit From 60f0e1858870849fa5d6ed56ea40dc0183fab77d Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 1 Nov 2021 17:48:19 +0000 Subject: vim-patch:8.2.0532: cannot use simplify() as a method Problem: Cannot use simplify() as a method. Solution: Add FEARG_1. (closes vim/vim#5996) https://github.com/vim/vim/commit/7035fd9d909c49cf5105a53753c1772c193d05b8 --- runtime/doc/eval.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 632329a65e..385ecb3dc2 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -9123,6 +9123,8 @@ simplify({filename}) *simplify()* directory. In order to resolve all the involved symbolic links before simplifying the path name, use |resolve()|. + Can also be used as a |method|: > + GetName()->simplify() sin({expr}) *sin()* Return the sine of {expr}, measured in radians, as a |Float|. -- cgit From 6bc9af43ceaf10992982369c74ac073072562068 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 1 Nov 2021 17:49:43 +0000 Subject: vim-patch:8.2.0871: cannot use getmarklist() as a method Problem: Cannot use getmarklist() as a method. Solution: Make getmarklist() work as a method. Add one to the column number to match getpos(). (Yegappan Lakshmanan, closes vim/vim#6176) https://github.com/vim/vim/commit/f17e7ea67a798d0aa45ce24ea80c9e21d5164326 The rest of this patch was ported in: https://github.com/neovim/neovim/commit/a1ed941a7881122fda2fd48e71e890ed55e4d08e --- runtime/doc/eval.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 385ecb3dc2..d71381347d 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5203,6 +5203,9 @@ getmarklist([{buf}]) *getmarklist()* Refer to |getpos()| for getting information about a specific mark. + Can also be used as a |method|: > + GetBufnr()->getmarklist() + getmatches([{win}]) *getmatches()* Returns a |List| with all matches previously defined for the current window by |matchadd()| and the |:match| commands. -- cgit From a0c7fff2840d0fc322e049fd06bf1e8e5bd0f38c Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 1 Nov 2021 18:18:02 +0000 Subject: vim-patch:8.2.1241: cannot use getbufinfo() as a method Problem: Cannot use getbufinfo() as a method. Solution: Support using getbufinfo() as a method. (closes vim/vim#6458) https://github.com/vim/vim/commit/6434fc574dfbde11461e70e5a62712370edf38e6 --- runtime/doc/eval.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d71381347d..8e6864889c 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4701,7 +4701,9 @@ getbufinfo([{dict}]) < To get buffer-local options use: > getbufvar({bufnr}, '&option_name') - +< + Can also be used as a |method|: > + GetBufnr()->getbufinfo() < *getbufline()* getbufline({buf}, {lnum} [, {end}]) -- cgit From 7e1a2301fffa32d60ecb7c15891a106d717100db Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sun, 31 Oct 2021 17:15:17 +0000 Subject: docs(eval): cherry-pick runtime update 2e693a88b2 https://github.com/vim/vim/commit/2e693a88b24dc6b12883fad78ff2cb9cd4469c98 Mainly to keep the method call docs up-to-date. Much of this RT update has already been ported. --- runtime/doc/eval.txt | 58 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 25 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 8e6864889c..4b49cb6b6e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3397,8 +3397,8 @@ complete({startcol}, {matches}) *complete()* *E785* < This isn't very useful, but it shows how it works. Note that an empty string is returned to avoid a zero being inserted. - Can also be used as a |method|, the second argument is passed - in: > + Can also be used as a |method|, the base is passed as the + second argument: > GetMatches()->complete(col('.')) complete_add({expr}) *complete_add()* @@ -3535,7 +3535,7 @@ confirm({msg} [, {choices} [, {default} [, {type}]]]) Can also be used as a |method|in: > BuildMessage()->confirm("&Yes\n&No") - +< *copy()* copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't different from using {expr} directly. @@ -3746,7 +3746,7 @@ deletebufline({buf}, {first}[, {last}]) *deletebufline()* Can also be used as a |method|: > GetBuffer()->deletebufline(1) - +< dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()* Adds a watcher to a dictionary. A dictionary watcher is identified by three components: @@ -3941,7 +3941,7 @@ exepath({expr}) *exepath()* Can also be used as a |method|: > GetCommand()->exepath() - +< *exists()* exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined, zero otherwise. @@ -4487,7 +4487,7 @@ foldlevel({lnum}) *foldlevel()* Can also be used as a |method|: > GetLnum()->foldlevel() - +< *foldtext()* foldtext() Returns a String, to be displayed for a closed fold. This is the default function used for the 'foldtext' option and should @@ -5861,7 +5861,7 @@ histadd({history}, {item}) *histadd()* :let date=input("Enter date: ") < This function is not available in the |sandbox|. - Can also be used as a |method|, the base is used for the + Can also be used as a |method|, the base is passed as the second argument: > GetHistory()->histadd('search') @@ -6508,8 +6508,8 @@ libcall({libname}, {funcname}, {argument}) Examples: > :echo libcall("libc.so", "getenv", "HOME") -< Can also be used as a |method|, where the base is passed as - the argument to the called function: > +< Can also be used as a |method|, the base is passed as the + third argument: > GetValue()->libcall("libc.so", "getenv") < *libcallnr()* @@ -6521,8 +6521,8 @@ libcallnr({libname}, {funcname}, {argument}) :call libcallnr("libc.so", "printf", "Hello World!\n") :call libcallnr("libc.so", "sleep", 10) < - Can also be used as a |method|, where the base is passed as - the argument to the called function: > + Can also be used as a |method|, the base is passed as the + third argument: > GetValue()->libcallnr("libc.so", "printf") < line({expr} [, {winid}]) *line()* @@ -7046,7 +7046,7 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()* Can also be used as a |method|: > GetText()->matchstrpos('word') - +< *max()* max({expr}) Return the maximum value of all items in {expr}. {expr} can be a |List| or a |Dictionary|. For a Dictionary, @@ -8594,7 +8594,8 @@ setbufline({buf}, {lnum}, {text}) *setbufline()* If {buf} is not a valid buffer or {lnum} is not valid, an error message is given. - Can also be used as a |method|: > + Can also be used as a |method|, the base is passed as the + third argument: > GetText()->setbufline(buf, lnum) setbufvar({buf}, {varname}, {val}) *setbufvar()* @@ -8611,7 +8612,8 @@ setbufvar({buf}, {varname}, {val}) *setbufvar()* :call setbufvar("todo", "myvar", "foobar") < This function is not available in the |sandbox|. - Can also be used as a |method|: > + Can also be used as a |method|, the base is passed as the + third argument: > GetValue()->setbufvar(buf, varname) setcharsearch({dict}) *setcharsearch()* @@ -8662,7 +8664,8 @@ setenv({name}, {val}) *setenv()* < When {val} is |v:null| the environment variable is deleted. See also |expr-env|. - Can also be used as a |method|, passing the value as the base: > + Can also be used as a |method|, the base is passed as the + second argument: > GetPath()->setenv('PATH') setfperm({fname}, {mode}) *setfperm()* *chmod* @@ -8710,7 +8713,8 @@ setline({lnum}, {text}) *setline()* < Note: The '[ and '] marks are not set. - Can also be used as a |method|, passing the text as the base: > + Can also be used as a |method|, the base is passed as the + second argument: > GetText()->setline(lnum) setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()* @@ -8977,7 +8981,8 @@ settabvar({tabnr}, {varname}, {val}) *settabvar()* Tabs are numbered starting with one. This function is not available in the |sandbox|. - Can also be used as a |method|, the base is used as the value: > + Can also be used as a |method|, the base is passed as the + third argument: > GetValue()->settabvar(tab, name) settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* @@ -8996,7 +9001,8 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()* :call settabwinvar(3, 2, "myvar", "foobar") < This function is not available in the |sandbox|. - Can also be used as a |method|, the base is used as the value: > + Can also be used as a |method|, the base is passed as the + fourth argument: > GetValue()->settabwinvar(tab, winnr, name) settagstack({nr}, {dict} [, {action}]) *settagstack()* @@ -9032,7 +9038,8 @@ settagstack({nr}, {dict} [, {action}]) *settagstack()* call settagstack(1003, stack) unlet stack < - Can also be used as a |method|, the base is used as the Dict: > + Can also be used as a |method|, the base is passed as the + second argument: > GetStack()->settagstack(winnr) setwinvar({nr}, {varname}, {val}) *setwinvar()* @@ -9041,7 +9048,8 @@ setwinvar({nr}, {varname}, {val}) *setwinvar()* :call setwinvar(1, "&list", 0) :call setwinvar(2, "myvar", "foobar") -< Can also be used as a |method|, the base is used as the value: > +< Can also be used as a |method|, the base is passed as the + third argument: > GetValue()->setwinvar(winnr, name) sha256({string}) *sha256()* @@ -9439,7 +9447,7 @@ str2nr({string} [, {base}]) *str2nr()* When {base} is omitted base 10 is used. This also means that a leading zero doesn't cause octal conversion to be used, as with the default String to Number conversion. Example: > - let nr = str2nr('123') + let nr = str2nr('0123') < When {base} is 16 a leading "0x" or "0X" is ignored. With a different base the result will be zero. Similarly, when @@ -10475,8 +10483,8 @@ win_execute({id}, {command} [, {silent}]) *win_execute()* Example: > call win_execute(winid, 'syntax enable') < - Can also be used as a |method|, the base is used for the - command: > + Can also be used as a |method|, the base is passed as the + second argument: > GetCommand()->win_execute(winid) win_findbuf({bufnr}) *win_findbuf()* @@ -10818,11 +10826,11 @@ xor({expr}, {expr}) *xor()* to a number. A List, Dict or Float argument causes an error. Example: > :let bits = xor(bits, 0x80) -< Can also be used as a |method|: > +< + Can also be used as a |method|: > :let bits = bits->xor(0x80) < - *string-match* Matching a pattern in a String -- cgit From 752ca2cb9f61b4dc523552d4123729b9b26a3409 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 1 Nov 2021 22:15:53 +0000 Subject: fix(eval/method): add missing method support for existing built-ins These functions were ported with the vim-patch token, but didn't actually port the method call support that was in their patches (method call syntax wasn't ported yet). Add the missing method call support and latest docs for: - assert_nobeep: https://github.com/vim/vim/commit/5b8cabfef7c3707f3e53e13844d90e5a217e1e84 - buffer_name, buffer_number: (obsolete) https://github.com/vim/vim/commit/a8eee21e75324d199acb1663cb5009e03014a13a - charidx: https://github.com/vim/vim/commit/17793ef23aae0bc94539390ccfe5e63b0ad39ff2 - flatten: https://github.com/vim/vim/commit/077a1e670ad69ef4cefc22103ca6635bd269e764 - prompt_getprompt: https://github.com/vim/vim/commit/077cc7aa0e0c431e97795612374fe17fe7c88803 - searchcount: https://github.com/vim/vim/commit/e8f5ec0d30b629d7166f0ad03434065d8bc822df - strptime: https://github.com/vim/vim/commit/10455d43fef041309ce0613fa792c635dd71e3a8 - win_gettype: https://github.com/vim/vim/commit/00f3b4e007af07870168bf044cecc9d544483953 - win_splitmove: https://github.com/vim/vim/commit/d20dcb3d011da6111153109f6e46fbd5c7fe9fb6 Also fix assert_beeps, assert_nobeep and getenv to accept exactly one argument. Previously, they could erroneously accept one or more. --- runtime/doc/eval.txt | 25 ++++++++++++++++++++++--- runtime/doc/testing.txt | 3 +++ 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 4b49cb6b6e..d1af4c4d72 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3262,7 +3262,7 @@ char2nr({string} [, {utf8}]) *char2nr()* Can also be used as a |method|: > GetChar()->char2nr() - +< *charidx()* charidx({string}, {idx} [, {countcc}]) Return the character index of the byte at {idx} in {string}. @@ -3285,6 +3285,9 @@ charidx({string}, {idx} [, {countcc}]) echo charidx('áb́ć', 3) returns 1 echo charidx('áb́ć', 6, 1) returns 4 echo charidx('áb́ć', 16) returns -1 +< + Can also be used as a |method|: > + GetName()->charidx(idx) chdir({dir}) *chdir()* Change the current working directory to {dir}. The scope of @@ -4364,6 +4367,9 @@ flatten({list} [, {maxdepth}]) *flatten()* :echo flatten([1, [2, [3, 4]], 5], 1) < [1, 2, [3, 4], 5] + Can also be used as a |method|: > + mylist->flatten() +< float2nr({expr}) *float2nr()* Convert {expr} to a Number by omitting the part after the decimal point. @@ -7596,6 +7602,9 @@ prompt_getprompt({buf}) *prompt_getprompt()* If the buffer doesn't exist or isn't a prompt buffer, an empty string is returned. + Can also be used as a |method|: > + GetBuffer()->prompt_getprompt() + prompt_setcallback({buf}, {expr}) *prompt_setcallback()* Set prompt callback for buffer {buf} to {expr}. When {expr} is an empty string the callback is removed. This has only @@ -8376,7 +8385,9 @@ searchcount([{options}]) *searchcount()* value. see |cursor()|, |getpos() (default: cursor's position) - + Can also be used as a |method|: > + GetSearchOpts()->searchcount() +< searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()* Search for the declaration of {name}. @@ -9653,7 +9664,9 @@ strptime({format}, {timestring}) *strptime()* :echo strftime("%c", strptime("%Y%m%d%H%M%S", "19970427115355") + 3600) < Sun Apr 27 12:53:55 1997 - + Can also be used as a |method|: > + GetFormat()->strptime(timestring) +< strridx({haystack}, {needle} [, {start}]) *strridx()* The result is a Number, which gives the byte index in {haystack} of the last occurrence of the String {needle}. @@ -10526,6 +10539,9 @@ win_gettype([{nr}]) *win_gettype()* popup window then 'buftype' is "terminal" and win_gettype() returns "popup". + Can also be used as a |method|: > + GetWinid()->win_gettype() +< win_gotoid({expr}) *win_gotoid()* Go to window with ID {expr}. This may also change the current tabpage. @@ -10581,6 +10597,9 @@ win_splitmove({nr}, {target} [, {options}]) *win_splitmove()* present, the values of 'splitbelow' and 'splitright' are used. + Can also be used as a |method|: > + GetWinid()->win_splitmove(target) +< *winbufnr()* winbufnr({nr}) The result is a Number, which is the number of the buffer associated with window {nr}. {nr} can be the window number or diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index f0bda5aaf8..8ec66d26a4 100644 --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -157,6 +157,9 @@ assert_nobeep({cmd}) *assert_nobeep()* produces a beep or visual bell. Also see |assert_beeps()|. + Can also be used as a |method|: > + GetCmd()->assert_nobeep() +< *assert_notequal()* assert_notequal({expected}, {actual} [, {msg}]) The opposite of `assert_equal()`: add an error message to -- cgit