1
0
forked from aniani/vim

patch 8.1.1961: more functions can be used as a method

Problem:    More functions can be used as a method.
Solution:   Allow more functions to be used as a method.  Add a test for
            mapcheck().
This commit is contained in:
Bram Moolenaar
2019-09-01 20:16:52 +02:00
parent db022f3ffb
commit a144983633
8 changed files with 110 additions and 28 deletions

View File

@@ -6699,6 +6699,8 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
mapped, and have it do the original mapping too. Sketch: >
exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n')
< Can also be used as a |method|: >
GetKey()->maparg('n')
mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
Check if there is a mapping that matches with {name} in mode
@@ -6733,6 +6735,9 @@ mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
< This avoids adding the "_vv" mapping when there already is a
mapping for "_v" or for "_vvv".
Can also be used as a |method|: >
GetKey()->mapcheck('n')
match({expr}, {pat} [, {start} [, {count}]]) *match()*
When {expr} is a |List| then this returns the index of the
first item where {pat} matches. Each item is used as a
@@ -6791,6 +6796,9 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()*
the pattern. 'smartcase' is NOT used. The matching is always
done like 'magic' is set and 'cpoptions' is empty.
Can also be used as a |method|: >
GetList()->match('word')
<
*matchadd()* *E798* *E799* *E801* *E957*
matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
Defines a pattern to be highlighted in the current window (a
@@ -6846,6 +6854,9 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
available from |getmatches()|. All matches can be deleted in
one operation by |clearmatches()|.
Can also be used as a |method|: >
GetGroup()->matchadd('TODO')
<
*matchaddpos()*
matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
Same as |matchadd()|, but requires a list of positions {pos}
@@ -6880,6 +6891,9 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
|getmatches()| with an entry "pos1", "pos2", etc., with the
value a list like the {pos} item.
Can also be used as a |method|: >
GetGroup()->matchaddpos([23, 11])
matcharg({nr}) *matcharg()*
Selects the {nr} match item, as set with a |:match|,
|:2match| or |:3match| command.
@@ -6892,6 +6906,9 @@ matcharg({nr}) *matcharg()*
Highlighting matches using the |:match| commands are limited
to three matches. |matchadd()| does not have this limitation.
Can also be used as a |method|: >
GetMatch()->matcharg()
matchdelete({id} [, {win}) *matchdelete()* *E802* *E803*
Deletes a match with ID {id} previously defined by |matchadd()|
or one of the |:match| commands. Returns 0 if successful,
@@ -6900,6 +6917,9 @@ matchdelete({id} [, {win}) *matchdelete()* *E802* *E803*
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|: >
GetMatch()->matchdelete()
matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
Same as |match()|, but return the index of first character
after the match. Example: >
@@ -6919,6 +6939,9 @@ matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
< result is "-1".
When {expr} is a |List| the result is equal to |match()|.
Can also be used as a |method|: >
GetText()->matchend('word')
matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
Same as |match()|, but return a |List|. The first item in the
list is the matched string, same as what matchstr() would
@@ -6929,6 +6952,9 @@ matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
< Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', '']
When there is no match an empty list is returned.
Can also be used as a |method|: >
GetList()->matchlist('word')
matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
Same as |match()|, but return the matched string. Example: >
:echo matchstr("testing", "ing")
@@ -6942,6 +6968,9 @@ matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()*
When {expr} is a |List| then the matching item is returned.
The type isn't changed, it's not necessarily a String.
Can also be used as a |method|: >
GetText()->matchstr('word')
matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()*
Same as |matchstr()|, but return the matched string, the start
position and the end position of the match. Example: >
@@ -6960,6 +6989,8 @@ matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()*
< result is ["x", 1, 2, 3].
The type isn't changed, it's not necessarily a String.
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,
@@ -7010,6 +7041,9 @@ mkdir({name} [, {path} [, {prot}]])
Not available on all systems. To check use: >
:if exists("*mkdir")
< Can also be used as a |method|: >
GetName()->mkdir()
<
*mode()*
mode([expr]) Return a string that indicates the current mode.
@@ -7055,6 +7089,9 @@ mode([expr]) Return a string that indicates the current mode.
the leading character(s).
Also see |visualmode()|.
Can also be used as a |method|: >
DoFull()->mode()
mzeval({expr}) *mzeval()*
Evaluate MzScheme expression {expr} and return its result
converted to Vim data structures.
@@ -7069,6 +7106,9 @@ mzeval({expr}) *mzeval()*
:mz (define h (make-hash)) (hash-set! h "list" l)
:echo mzeval("l")
:echo mzeval("h")
<
Can also be used as a |method|: >
GetExpr()->mzeval()
<
{only available when compiled with the |+mzscheme| feature}