diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-07 17:06:08 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-12 22:35:24 +0100 |
commit | 5fbc1a49c719c0c93fa73277ac30d17f797d096d (patch) | |
tree | c23089dd05097a388cad40e42d284ffdb78fcd90 /runtime | |
parent | 41dbd3a2e05f5f4d59e076f8b8c82ad974d2bbd5 (diff) | |
download | rneovim-5fbc1a49c719c0c93fa73277ac30d17f797d096d.tar.gz rneovim-5fbc1a49c719c0c93fa73277ac30d17f797d096d.tar.bz2 rneovim-5fbc1a49c719c0c93fa73277ac30d17f797d096d.zip |
vim-patch:8.1.1888: 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/073e4b92e613d22ce7b16e0fbf5c0e40cb5f9b2c
test_popup.vim already has the changes from this patch (they're N/A
anyway).
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 814931ff2b..511d072366 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2650,6 +2650,8 @@ and({expr}, {expr}) *and()* to a number. A List, Dict or Float argument causes an error. Example: > :let flag = and(bits, 0x80) +< Can also be used as a |method|: > + :let flag = bits->and(0x80) api_info() *api_info()* Returns Dictionary of |api-metadata|. @@ -2788,8 +2790,8 @@ browse({save}, {title}, {initdir}, {default}) {title} title for the requester {initdir} directory to start browsing in {default} default file name - When the "Cancel" button is hit, something went wrong, or - browsing is not possible, an empty string is returned. + An empty string is returned when the "Cancel" button is hit, + something went wrong, or browsing is not possible. *browsedir()* browsedir({title}, {initdir}) @@ -2811,6 +2813,8 @@ bufadd({name}) *bufadd()* created buffer. When {name} is an empty string then a new buffer is always created. The buffer will not have' 'buflisted' set. +< Can also be used as a |method|: > + let bufnr = 'somename'->bufadd() bufexists({expr}) *bufexists()* The result is a Number, which is |TRUE| if a buffer called @@ -2834,11 +2838,17 @@ bufexists({expr}) *bufexists()* Use "bufexists(0)" to test for the existence of an alternate file name. + Can also be used as a |method|: > + let exists = 'somename'->bufexists() + buflisted({expr}) *buflisted()* The result is a Number, which is |TRUE| if a buffer called {expr} exists and is listed (has the 'buflisted' option set). The {expr} argument is used like with |bufexists()|. + Can also be used as a |method|: > + let listed = 'somename'->buflisted() + bufload({expr}) *bufload()* Ensure the buffer {expr} is loaded. When the buffer name refers to an existing file then the file is read. Otherwise @@ -2848,15 +2858,21 @@ bufload({expr}) *bufload()* there will be no dialog, the buffer will be loaded anyway. The {expr} argument is used like with |bufexists()|. + Can also be used as a |method|: > + eval 'somename'->bufload() + bufloaded({expr}) *bufloaded()* The result is a Number, which is |TRUE| if a buffer called {expr} exists and is loaded (shown in a window or hidden). The {expr} argument is used like with |bufexists()|. + Can also be used as a |method|: > + let loaded = 'somename'->bufloaded() + bufname([{expr}]) *bufname()* The result is the name of a buffer, as it is displayed by the ":ls" command. -+ If {expr} is omitted the current buffer is used. + If {expr} is omitted the current buffer is used. If {expr} is a Number, that buffer number's name is given. Number zero is the alternate buffer for the current window. If {expr} is a String, it is used as a |file-pattern| to match @@ -2875,6 +2891,9 @@ bufname([{expr}]) *bufname()* If the {expr} 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 @@ -2897,6 +2916,9 @@ bufnr([{expr} [, {create}]]) 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() + bufwinid({expr}) *bufwinid()* The result is a Number, which is the |window-ID| of the first window associated with buffer {expr}. For the use of {expr}, @@ -5624,6 +5646,8 @@ invert({expr}) *invert()* Bitwise invert. The argument is converted to a number. A List, Dict or Float argument causes an error. Example: > :let bits = invert(bits) +< Can also be used as a |method|: > + :let bits = bits->invert() isdirectory({directory}) *isdirectory()* The result is a Number, which is |TRUE| when a directory @@ -6645,7 +6669,8 @@ or({expr}, {expr}) *or()* to a number. A List, Dict or Float argument causes an error. Example: > :let bits = or(bits, 0x80) - +< Can also be used as a |method|: > + :let bits = bits->or(0x80) pathshorten({expr}) *pathshorten()* Shorten directory names in the path {expr} and return the @@ -9807,6 +9832,8 @@ 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|: > + :let bits = bits->xor(0x80) < |