diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-06 18:10:30 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-12 22:35:20 +0100 |
commit | aa2dc8b7b4e0e86c9102f2df6b670317c5693657 (patch) | |
tree | 669a96d841cc4ab90c83bbb1b86ed5cc38013c3b /runtime | |
parent | 003c8acc8a9863932430bfb51bee8403b964c19b (diff) | |
download | rneovim-aa2dc8b7b4e0e86c9102f2df6b670317c5693657.tar.gz rneovim-aa2dc8b7b4e0e86c9102f2df6b670317c5693657.tar.bz2 rneovim-aa2dc8b7b4e0e86c9102f2df6b670317c5693657.zip |
vim-patch:8.1.1809: more functions can be used as a method
Problem: More functions can be used as a method.
Solution: Add has_key(), split(), str2list(), etc.
https://github.com/vim/vim/commit/a74e4946de074d2916e3d6004f7fa1810d12dda9
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 070c94da3b..a5940a963c 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3274,6 +3274,7 @@ count({comp}, {expr} [, {ic} [, {start}]]) *count()* When {comp} is a string then the number of not overlapping occurrences of {expr} is returned. Zero is returned when {expr} is an empty string. + Can also be used as a |method|: > mylist->count(val) @@ -5212,6 +5213,9 @@ has_key({dict}, {key}) *has_key()* The result is a Number, which is TRUE if |Dictionary| {dict} has an entry with key {key}. FALSE otherwise. + Can also be used as a |method|: > + mydict->has_key(key) + haslocaldir([{winnr}[, {tabnr}]]) *haslocaldir()* The result is a Number, which is 1 when the tabpage or window has set a local path via |:tcd| or |:lcd|, otherwise 0. @@ -8376,6 +8380,8 @@ split({expr} [, {pattern} [, {keepempty}]]) *split()* :let items = split(line, ':', 1) < The opposite function is |join()|. + Can also be used as a |method|: > + GetString()->split() sqrt({expr}) *sqrt()* Return the non-negative square root of Float {expr} as a @@ -8454,12 +8460,18 @@ str2list({expr} [, {utf8}]) *str2list()* properly: > str2list("á") returns [97, 769] +< Can also be used as a |method|: > + GetString()->str2list() + str2nr({expr} [, {base}]) *str2nr()* Convert string {expr} to a number. {base} is the conversion base, it can be 2, 8, 10 or 16. + When {base} is omitted base 10 is used. This also means that a leading zero doesn't cause octal conversion to be used, as - with the default String to Number conversion. + with the default String to Number conversion. Example: > + let nr = str2nr('123') +< When {base} is 16 a leading "0x" or "0X" is ignored. With a different base the result will be zero. Similarly, when {base} is 8 a leading "0" is ignored, and when {base} is 2 a leading @@ -8590,6 +8602,9 @@ strlen({expr}) The result is a Number, which is the length of the String |strchars()|. Also see |len()|, |strdisplaywidth()| and |strwidth()|. + Can also be used as a |method|: > + GetString()->strlen() + strpart({src}, {start} [, {len} [, {chars}]]) *strpart()* The result is a String, which is part of {src}, starting from byte {start}, with the byte length {len}. @@ -8664,6 +8679,9 @@ strtrans({expr}) *strtrans()* < This displays a newline in register a as "^@" instead of starting a new line. + Can also be used as a |method|: > + GetString()->strtrans() + strwidth({expr}) *strwidth()* The result is a Number, which is the number of display cells String {expr} occupies. A Tab character is counted as one @@ -8672,6 +8690,9 @@ strwidth({expr}) *strwidth()* Ambiguous, this function's return value depends on 'ambiwidth'. Also see |strlen()|, |strdisplaywidth()| and |strchars()|. + Can also be used as a |method|: > + GetString()->strwidth() + submatch({nr} [, {list}]) *submatch()* *E935* Only for an expression in a |:substitute| command or substitute() function. @@ -8739,6 +8760,9 @@ substitute({expr}, {pat}, {sub}, {flags}) *substitute()* |submatch()| returns. Example: > :echo substitute(s, '%\(\x\x\)', {m -> '0x' . m[1]}, 'g') +< Can also be used as a |method|: > + GetString()->substitute(pat, sub, flags) + swapinfo({fname}) *swapinfo()* The result is a dictionary, which holds information about the swapfile {fname}. The available fields are: @@ -8823,12 +8847,18 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()* cursor): > :echo synIDattr(synIDtrans(synID(line("."), col("."), 1)), "fg") < + Can also be used as a |method|: > + :echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg") + synIDtrans({synID}) *synIDtrans()* The result is a Number, which is the translated syntax ID of {synID}. This is the syntax group ID of what is being used to highlight the character. Highlight links given with ":highlight link" are followed. + Can also be used as a |method|: > + :echo synID(line("."), col("."), 1)->synIDtrans()->synIDattr("fg") + synconcealed({lnum}, {col}) *synconcealed()* The result is a |List| with currently three items: 1. The first item in the list is 0 if the character at the @@ -8925,6 +8955,8 @@ system({cmd} [, {input}]) *system()* *E677* Unlike ":!cmd" there is no automatic check for changed files. Use |:checktime| to force a check. + Can also be used as a |method|: > + :echo GetCmd()->system() systemlist({cmd} [, {input} [, {keepempty}]]) *systemlist()* Same as |system()|, but returns a |List| with lines (parts of @@ -8940,6 +8972,8 @@ systemlist({cmd} [, {input} [, {keepempty}]]) *systemlist()* < Returns an empty string on error. + Can also be used as a |method|: > + :echo GetCmd()->systemlist() tabpagebuflist([{arg}]) *tabpagebuflist()* The result is a |List|, where each item is the number of the |