summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-07 19:05:09 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-07 19:05:09 +0200
commitf6ed61e1489e40eada55a4f1782e1ed82bcad7d9 (patch)
tree59c67f3a73489d4536e741b883a9ad5f45c3cc2f /runtime
parent30e9b3c4256710781c3bd64efb33f138e4e074b3 (diff)
patch 8.1.2004: more functions can be used as methodsv8.1.2004
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.txt71
1 files changed, 62 insertions, 9 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 26a28dca3e..772fd1d7ae 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -8895,7 +8895,11 @@ sound_playevent({name} [, {callback}])
Returns the sound ID, which can be passed to `sound_stop()`.
Returns zero if the sound could not be played.
- {only available when compiled with the |+sound| feature}
+
+ Can also be used as a |method|: >
+ GetSoundName()->sound_playevent()
+
+< {only available when compiled with the |+sound| feature}
*sound_playfile()*
sound_playfile({path} [, {callback}])
@@ -8903,6 +8907,10 @@ sound_playfile({path} [, {callback}])
must be a full path. On Ubuntu you may find files to play
with this command: >
:!find /usr/share/sounds -type f | grep -v index.theme
+
+< Can also be used as a |method|: >
+ GetSoundPath()->sound_playfile()
+
< {only available when compiled with the |+sound| feature}
@@ -8913,7 +8921,10 @@ sound_stop({id}) *sound_stop()*
On MS-Windows, this does not work for event sound started by
`sound_playevent()`. To stop event sounds, use `sound_clear()`.
- {only available when compiled with the |+sound| feature}
+ Can also be used as a |method|: >
+ soundid->sound_stop()
+
+< {only available when compiled with the |+sound| feature}
*soundfold()*
soundfold({word})
@@ -8924,6 +8935,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
@@ -8950,6 +8964,9 @@ spellbadword([{sentence}])
'spell' option must be set and the value of 'spelllang' is
used.
+ Can also be used as a |method|: >
+ GetText()->spellbadword()
+<
*spellsuggest()*
spellsuggest({word} [, {max} [, {capital}]])
Return a |List| with spelling suggestions to replace {word}.
@@ -8973,6 +8990,8 @@ spellsuggest({word} [, {max} [, {capital}]])
'spell' option must be set and the values of 'spelllang' and
'spellsuggest' are used.
+ Can also be used as a |method|: >
+ GetWord()->spellsuggest()
split({expr} [, {pattern} [, {keepempty}]]) *split()*
Make a |List| out of {expr}. When {pattern} is omitted or
@@ -9069,6 +9088,19 @@ str2nr({expr} [, {base}]) *str2nr()*
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.
+ 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({expr} [, {skipcc}]) *strchars()*
The result is a Number, which is the number of characters
@@ -9094,13 +9126,8 @@ strchars({expr} [, {skipcc}]) *strchars()*
endfunction
endif
<
-strcharpart({src}, {start} [, {len}]) *strcharpart()*
- Like |strpart()| but using character index and length instead
- of byte index and length.
- 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({expr} [, {col}]) *strdisplaywidth()*
The result is a Number, which is the number of display cells
@@ -9115,6 +9142,9 @@ strdisplaywidth({expr} [, {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,
@@ -9134,12 +9164,18 @@ strftime({format} [, {time}]) *strftime()*
< Not available on all systems. To check use: >
:if exists("*strftime")
+< 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}.
@@ -9159,6 +9195,8 @@ 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
@@ -9211,6 +9249,9 @@ strpart({src}, {start} [, {len}]) *strpart()*
example, to get three bytes under and after the cursor: >
strpart(getline("."), col(".") - 1, 3)
<
+ Can also be used as a |method|: >
+ GetText()->strpart(5)
+
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}.
@@ -9229,6 +9270,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({expr}) *strtrans()*
The result is a String, which is {expr} with all unprintable
characters translated into printable characters |'isprint'|.
@@ -9277,6 +9321,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({expr}, {pat}, {sub}, {flags}) *substitute()*
The result is a String, which is a copy of {expr}, in which
the first match of {pat} is replaced with {sub}.
@@ -9340,6 +9387,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({expr}) *swapname()*
The result is the swap file path of the buffer {expr}.
For the use of {expr}, see |bufname()| above.
@@ -9347,6 +9397,9 @@ swapname({expr}) *swapname()*
|:swapname| (unless no swap file).
If buffer {expr} 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.