aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-08-31 22:51:29 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-10-03 20:06:32 +0100
commit59c8a1fd5158886cb13b56070ebf15259d12eba2 (patch)
tree9f38ebf07476c8d4f3e9baa5801ed787ff197a04 /runtime
parent8b7615c735325245cff20907fbd7e0470a0d00d0 (diff)
downloadrneovim-59c8a1fd5158886cb13b56070ebf15259d12eba2.tar.gz
rneovim-59c8a1fd5158886cb13b56070ebf15259d12eba2.tar.bz2
rneovim-59c8a1fd5158886cb13b56070ebf15259d12eba2.zip
feat(eval/method): partially port v8.1.1953
Adds method call support for all functions in the patch, but it cannot be fully ported due to missing tests for: - index(): requires Blobs from v8.1.0735. Note that index() was already added as a method in v8.1.1803; this patch only adds a test. - iconv(): requires v8.1.1136 for test_termcodes.vim. Nvim deprecated inputdialog(), so it no longer has an eval.txt entry. Keep the test for hlexists() commented-out, just like previously. (Nvim always defines the Number group, so it always returns 1 instead) Cannot include both changes to test_syn_attr.vim as Nvim doesn't support ":hi term=..."; however, both test the same ->hlID() syntax anyway.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt47
1 files changed, 47 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index ffc6221818..f998c5750a 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -5763,6 +5763,9 @@ haslocaldir([{winnr}[, {tabnr}]]) *haslocaldir()*
{winnr} can be the window number or the |window-ID|.
If {winnr} is -1 it is ignored, only the tab is resolved.
+ Can also be used as a |method|: >
+ GetWinnr()->haslocaldir()
+
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
The result is a Number, which is TRUE if there is a mapping
that contains {what} in somewhere in the rhs (what it is
@@ -5792,6 +5795,9 @@ hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
< This installs the mapping to "\ABCdoit" only if there isn't
already a mapping to "\ABCdoit".
+ Can also be used as a |method|: >
+ GetRHS()->hasmapto()
+
histadd({history}, {item}) *histadd()*
Add the String {item} to the history {history} which can be
one of: *hist-names*
@@ -5813,6 +5819,10 @@ 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
+ second argument: >
+ GetPattern()->histadd('search')
+
histdel({history} [, {item}]) *histdel()*
Clear {history}, i.e. delete all its entries. See |hist-names|
for the possible values of {history}.
@@ -5844,6 +5854,9 @@ histdel({history} [, {item}]) *histdel()*
the "n" command and 'hlsearch': >
:call histdel("search", -1)
:let @/ = histget("search", -1)
+<
+ Can also be used as a |method|: >
+ GetHistory()->histdel()
histget({history} [, {index}]) *histget()*
The result is a String, the entry with Number {index} from
@@ -5860,6 +5873,9 @@ histget({history} [, {index}]) *histget()*
the {num}th entry from the output of |:history|. >
:command -nargs=1 H execute histget("cmd", 0+<args>)
<
+ Can also be used as a |method|: >
+ GetHistory()->histget()
+
histnr({history}) *histnr()*
The result is the Number of the current entry in {history}.
See |hist-names| for the possible values of {history}.
@@ -5867,6 +5883,9 @@ histnr({history}) *histnr()*
Example: >
:let inp_index = histnr("expr")
+
+< Can also be used as a |method|: >
+ GetHistory()->histnr()
<
hlexists({name}) *hlexists()*
The result is a Number, which is TRUE if a highlight group
@@ -5875,6 +5894,9 @@ hlexists({name}) *hlexists()*
been defined for it, it may also have been used for a syntax
item.
+ Can also be used as a |method|: >
+ GetName()->hlexists()
+<
*hlID()*
hlID({name}) The result is a Number, which is the ID of the highlight group
with name {name}. When the highlight group doesn't exist,
@@ -5883,6 +5905,9 @@ hlID({name}) The result is a Number, which is the ID of the highlight group
group. For example, to get the background color of the
"Comment" group: >
:echo synIDattr(synIDtrans(hlID("Comment")), "bg")
+<
+ Can also be used as a |method|: >
+ GetName()->hlID()
hostname() *hostname()*
The result is a String, which is the name of the machine on
@@ -5901,6 +5926,9 @@ iconv({string}, {from}, {to}) *iconv()*
from/to UCS-2 is automatically changed to use UTF-8. You
cannot use UCS-2 in a string anyway, because of the NUL bytes.
+ Can also be used as a |method|: >
+ GetText()->iconv('latin1', 'utf-8')
+<
*indent()*
indent({lnum}) The result is a Number, which is indent of line {lnum} in the
current buffer. The indent is counted in spaces, the value
@@ -5908,6 +5936,8 @@ indent({lnum}) The result is a Number, which is indent of line {lnum} in the
|getline()|.
When {lnum} is invalid -1 is returned.
+ Can also be used as a |method|: >
+ GetLnum()->indent()
index({object}, {expr} [, {start} [, {ic}]]) *index()*
If {object} is a |List| return the lowest index where the item
@@ -5928,6 +5958,8 @@ index({object}, {expr} [, {start} [, {ic}]]) *index()*
:let idx = index(words, "the")
:if index(numbers, 123) >= 0
+< Can also be used as a |method|: >
+ GetObject()->index(what)
input({prompt} [, {text} [, {completion}]]) *input()*
input({opts})
@@ -6040,6 +6072,9 @@ input({opts})
: call inputrestore()
:endfunction
+< Can also be used as a |method|: >
+ GetPrompt()->input()
+
inputlist({textlist}) *inputlist()*
{textlist} must be a |List| of strings. This |List| is
displayed, one string per line. The user will be prompted to
@@ -6057,6 +6092,9 @@ inputlist({textlist}) *inputlist()*
let color = inputlist(['Select color:', '1. red',
\ '2. green', '3. blue'])
+< Can also be used as a |method|: >
+ GetChoices()->inputlist()
+
inputrestore() *inputrestore()*
Restore typeahead that was saved with a previous |inputsave()|.
Should be called the same number of times inputsave() is
@@ -6082,6 +6120,9 @@ inputsecret({prompt} [, {text}]) *inputsecret()*
typed on the command-line in response to the issued prompt.
NOTE: Command-line completion is not supported.
+ Can also be used as a |method|: >
+ GetPrompt()->inputsecret()
+
insert({object}, {item} [, {idx}]) *insert()*
When {object} is a |List| or a |Blob| insert {item} at the start
of it.
@@ -6128,6 +6169,9 @@ isdirectory({directory}) *isdirectory()*
exist, or isn't a directory, the result is |FALSE|. {directory}
is any expression, which is used as a String.
+ Can also be used as a |method|: >
+ GetName()->isdirectory()
+
isinf({expr}) *isinf()*
Return 1 if {expr} is a positive infinity, or -1 a negative
infinity, otherwise 0. >
@@ -6153,6 +6197,9 @@ islocked({expr}) *islocked()* *E786*
< When {expr} is a variable that does not exist you get an error
message. Use |exists()| to check for existence.
+ Can also be used as a |method|: >
+ GetName()->islocked()
+
id({expr}) *id()*
Returns a |String| which is a unique identifier of the
container type (|List|, |Dict|, |Blob| and |Partial|). It is