diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-09-06 21:34:30 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-09-06 21:34:30 +0200 |
commit | 196b4664432f932625cfb6371dc42c24efe6c203 (patch) | |
tree | 95294d46aa15e3fccbee2422f352b46958d9f593 /runtime | |
parent | 16b58ae9f36e9675c34d942f5d5f8c8a7914dbc4 (diff) |
patch 8.1.1993: more functions can be used as methodsv8.1.1993
Problem: More functions can be used as methods.
Solution: Make various functions usable as a method.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 8d51ab0e15..cc90cbf913 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5833,7 +5833,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| @@ -7923,6 +7923,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 @@ -7933,6 +7936,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 @@ -7940,6 +7946,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. @@ -7970,6 +7979,9 @@ screenpos({winid}, {lnum}, {col}) *screenpos()* a Tab it would be the same as "endcol", while for a double width character it would be the same as "col". + 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. @@ -7986,6 +7998,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). @@ -8072,6 +8087,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() searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()* Search for the declaration of {name}. @@ -8091,6 +8108,9 @@ searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()* echo getline('.') endif < + Can also be used as a |method|: > + GetName()->searchdecl() +< *searchpair()* searchpair({start}, {middle}, {end} [, {flags} [, {skip} [, {stopline} [, {timeout}]]]]) @@ -8205,6 +8225,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("<client>"). @@ -8216,6 +8239,9 @@ server2client({clientid}, {string}) *server2client()* See also |clientserver|. Example: > :echo server2client(expand("<client>"), "HELLO") + +< Can also be used as a |method|: > + GetClientId()->server2client(string) < serverlist() *serverlist()* Return a list of available server names, one per line. @@ -8239,6 +8265,9 @@ setbufline({expr}, {lnum}, {text}) *setbufline()* {lnum} is not valid then 1 is returned. On success 0 is returned. + Can also be used as a |method|: > + GetText()->setbufline(buf, lnum) + setbufvar({expr}, {varname}, {val}) *setbufvar()* Set option or local variable {varname} in buffer {expr} to {val}. @@ -8252,6 +8281,9 @@ setbufvar({expr}, {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: @@ -8272,6 +8304,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. @@ -8287,11 +8322,17 @@ setcmdpos({pos}) *setcmdpos()* Returns 0 when successful, 1 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}. 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 @@ -8338,6 +8379,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|. |