diff options
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r-- | runtime/doc/eval.txt | 482 |
1 files changed, 445 insertions, 37 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index b3d5f4d7e9..6549d0b5f3 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -586,7 +586,7 @@ It is not necessary to use the "dict" attribute for a numbered function. If you get an error for a numbered function, you can find out what it is with a trick. Assuming the function is 42, the command is: > - :function {42} + :function g:42 Functions for Dictionaries ~ @@ -1204,7 +1204,7 @@ next method: > mylist->filter(filterexpr)->map(mapexpr)->sort()->join() < Example of using a lambda: > - GetPercentage->{x -> x * 100}()->printf('%d%%') + GetPercentage()->{x -> x * 100}()->printf('%d%%') < When using -> the |expr7| operators will be applied first, thus: > -1.234->string() @@ -1307,7 +1307,7 @@ A string constant accepts these special characters: \U.... same as \u but allows up to 8 hex numbers. \b backspace <BS> \e escape <Esc> -\f formfeed <FF> +\f formfeed 0x0C \n newline <NL> \r return <CR> \t tab <Tab> @@ -1316,7 +1316,7 @@ A string constant accepts these special characters: \<xxx> Special key named "xxx". e.g. "\<C-W>" for CTRL-W. This is for use in mappings, the 0x80 byte is escaped. To use the double quote character it must be escaped: "<M-\">". - Don't use <Char-xxxx> to get a utf-8 character, use \uxxxx as + Don't use <Char-xxxx> to get a UTF-8 character, use \uxxxx as mentioned above. Note that "\xff" is stored as the byte 255, which may be invalid in some @@ -2313,9 +2313,10 @@ ceil({expr}) Float round {expr} up changenr() Number current change number chanclose({id}[, {stream}]) Number Closes a channel or one of its streams chansend({id}, {data}) Number Writes {data} to channel -char2nr({expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr} +char2nr({expr}[, {utf8}]) Number ASCII/UTF-8 value of first char in {expr} charidx({string}, {idx} [, {countcc}]) Number char index of byte {idx} in {string} +chdir({dir}) String change current working directory cindent({lnum}) Number C indent for line {lnum} clearmatches([{win}]) none clear all matches col({expr}) Number column nr of cursor or mark @@ -2431,13 +2432,15 @@ getloclist({nr}) List list of location list items getloclist({nr}, {what}) Dict get specific location list properties getmarklist([{buf}]) List list of global/local marks getmatches([{win}]) List list of current matches +getmousepos() Dict last known mouse position getpid() Number process ID of Vim getpos({expr}) List position of cursor, mark, etc. getqflist() List list of quickfix items getqflist({what}) Dict get specific quickfix list properties getreg([{regname} [, 1 [, {list}]]]) - String or List contents of register -getregtype([{regname}]) String type of register + String or List contents of a register +getreginfo([{regname}]) Dict information about a register +getregtype([{regname}]) String type of a register gettabinfo([{expr}]) List list of tab pages gettabvar({nr}, {varname} [, {def}]) any variable {varname} in tab {nr} or {def} @@ -2458,7 +2461,8 @@ globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) has({feature}) Number |TRUE| if feature {feature} supported has_key({dict}, {key}) Number |TRUE| if {dict} has entry {key} haslocaldir([{winnr} [, {tabnr}]]) - Number |TRUE| if current window executed |:lcd| + Number |TRUE| if the window executed |:lcd| or + the tab executed |:tcd| hasmapto({what} [, {mode} [, {abbr}]]) Number |TRUE| if mapping to {what} exists histadd({history}, {item}) String add an item to a history @@ -2503,7 +2507,7 @@ keys({dict}) List keys in {dict} len({expr}) Number the length of {expr} libcall({lib}, {func}, {arg}) String call {func} in library {lib} with {arg} libcallnr({lib}, {func}, {arg}) Number idem, but return a Number -line({expr}) Number line nr of cursor, last line or mark +line({expr} [, {winid}]) Number line nr of cursor, last line or mark line2byte({lnum}) Number byte count of line {lnum} lispindent({lnum}) Number Lisp indent for line {lnum} list2str({list} [, {utf8}]) String turn numbers in {list} into a String @@ -2542,7 +2546,7 @@ mode([expr]) String current editing mode msgpackdump({list} [, {type}]) List/Blob dump objects to msgpack msgpackparse({data}) List parse msgpack to a list of objects nextnonblank({lnum}) Number line nr of non-blank line >= {lnum} -nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} +nr2char({expr}[, {utf8}]) String single char with ASCII/UTF-8 value {expr} nvim_...({args}...) any call nvim |api| functions or({expr}, {expr}) Number bitwise OR pathshorten({expr}) String shorten directory names in a path @@ -2678,7 +2682,7 @@ stdioopen({dict}) Number open stdio in a headless instance. stdpath({what}) String/List returns the standard path(s) for {what} str2float({expr} [, {quoted}]) Float convert String to Float str2list({expr} [, {utf8}]) List convert each character of {expr} to - ASCII/UTF8 value + ASCII/UTF-8 value str2nr({expr} [, {base} [, {quoted}]]) Number convert String to Number strchars({expr} [, {skipcc}]) Number character length of the String {expr} @@ -3278,6 +3282,27 @@ charidx({string}, {idx} [, {countcc}]) echo charidx('áb́ć', 6, 1) returns 4 echo charidx('áb́ć', 16) returns -1 +chdir({dir}) *chdir()* + Change the current working directory to {dir}. The scope of + the directory change depends on the directory of the current + window: + - If the current window has a window-local directory + (|:lcd|), then changes the window local directory. + - Otherwise, if the current tabpage has a local + directory (|:tcd|) then changes the tabpage local + directory. + - Otherwise, changes the global directory. + If successful, returns the previous working directory. Pass + this to another chdir() to restore the directory. + On failure, returns an empty string. + + Example: > + let save_dir = chdir(newdir) + if save_dir + " ... do some work + call chdir(save_dir) + endif +< cindent({lnum}) *cindent()* Get the amount of indent for line {lnum} according the C indenting rules, as with 'cindent'. @@ -3417,6 +3442,8 @@ complete_info([{what}]) *complete_info()* "" Not in completion mode "keyword" Keyword completion |i_CTRL-X_CTRL-N| "ctrl_x" Just pressed CTRL-X |i_CTRL-X| + "scroll" Scrolling with |i_CTRL-X_CTRL-E| or + |i_CTRL-X_CTRL-Y| "whole_line" Whole lines |i_CTRL-X_CTRL-L| "files" File names |i_CTRL-X_CTRL-F| "tags" Tags |i_CTRL-X_CTRL-]| @@ -3827,6 +3854,9 @@ escape({string}, {chars}) *escape()* c:\\program\ files\\vim < Also see |shellescape()| and |fnameescape()|. + Can also be used as a |method|: > + GetText()->escape(' \') +< *eval()* eval({string}) Evaluate {string} and return the result. Especially useful to turn the result of |string()| back into the original value. @@ -3866,6 +3896,9 @@ executable({expr}) *executable()* -1 not implemented on this system |exepath()| can be used to get the full path of an executable. + Can also be used as a |method|: > + GetCommand()->executable() + execute({command} [, {silent}]) *execute()* Execute {command} and capture its output. If {command} is a |String|, returns {command} output. @@ -3893,12 +3926,18 @@ execute({command} [, {silent}]) *execute()* To execute a command in another window than the current one use `win_execute()`. + Can also be used as a |method|: > + GetCommand()->execute() + exepath({expr}) *exepath()* Returns the full path of {expr} if it is an executable and given as a (partial or full) path or is found in $PATH. Returns empty string otherwise. If {expr} starts with "./" the |current-directory| is used. + Can also be used as a |method|: > + GetCommand()->exepath() + *exists()* exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined, zero otherwise. @@ -3984,6 +4023,9 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is < This doesn't check for existence of the "bufcount" variable, but gets the value of "bufcount", and checks if that exists. + Can also be used as a |method|: > + Varname()->exists() + exp({expr}) *exp()* Return the exponential of {expr} as a |Float| in the range [0, inf]. @@ -4090,6 +4132,9 @@ expand({string} [, {nosuf} [, {list}]]) *expand()* See |glob()| for finding existing files. See |system()| for getting the raw output of an external command. + Can also be used as a |method|: > + Getpattern()->expand() + expandcmd({expr}) *expandcmd()* Expand special items in {expr} like what is done for an Ex command such as `:edit`. This expands special keywords, like @@ -4097,6 +4142,9 @@ expandcmd({expr}) *expandcmd()* {expr}. "~user" and "~/path" are only expanded at the start. Returns the expanded string. Example: > :echo expandcmd('make %<.o') + +< Can also be used as a |method|: > + GetCommand()->expandcmd() < extend({expr1}, {expr2} [, {expr3}]) *extend()* {expr1} and {expr2} must be both |Lists| or both @@ -4182,6 +4230,9 @@ feedkeys({string} [, {mode}]) *feedkeys()* Return value is always 0. + Can also be used as a |method|: > + GetInput()->feedkeys() + filereadable({file}) *filereadable()* The result is a Number, which is |TRUE| when a file with the name {file} exists, and can be read. If {file} doesn't exist, @@ -4195,12 +4246,17 @@ filereadable({file}) *filereadable()* echo filereadable(expand('~/.vimrc')) 1 +< Can also be used as a |method|: > + GetName()->filereadable() + filewritable({file}) *filewritable()* The result is a Number, which is 1 when a file with the name {file} exists, and can be written. If {file} doesn't exist, or is not writable, the result is 0. If {file} is a directory, and we can write to it, the result is 2. + Can also be used as a |method|: > + GetName()->filewriteable() filter({expr1}, {expr2}) *filter()* {expr1} must be a |List|, |Blob|, or a |Dictionary|. @@ -4271,6 +4327,9 @@ finddir({name} [, {path} [, {count}]]) *finddir()* This is quite similar to the ex-command `:find`. + Can also be used as a |method|: > + GetName()->finddir() + findfile({name} [, {path} [, {count}]]) *findfile()* Just like |finddir()|, but find a file instead of a directory. Uses 'suffixesadd'. @@ -4279,6 +4338,9 @@ findfile({name} [, {path} [, {count}]]) *findfile()* < Searches from the directory of the current file upwards until it finds the file "tags.vim". + Can also be used as a |method|: > + GetName()->findfile() + flatten({list} [, {maxdepth}]) *flatten()* Flatten {list} up to {maxdepth} levels. Without {maxdepth} the result is a |List| without nesting, as if {maxdepth} is @@ -4368,6 +4430,9 @@ fnameescape({string}) *fnameescape()* :exe "edit " . fnameescape(fname) < results in executing: > edit \+some\ str\%nge\|name +< + Can also be used as a |method|: > + GetName()->fnameescape() fnamemodify({fname}, {mods}) *fnamemodify()* Modify file name {fname} according to {mods}. {mods} is a @@ -4381,6 +4446,9 @@ fnamemodify({fname}, {mods}) *fnamemodify()* Note: Environment variables don't work in {fname}, use |expand()| first then. + Can also be used as a |method|: > + GetName()->fnamemodify(':p:h') + foldclosed({lnum}) *foldclosed()* The result is a Number. If the line {lnum} is in a closed fold, the result is the number of the first line in that fold. @@ -4388,6 +4456,9 @@ foldclosed({lnum}) *foldclosed()* {lnum} is used like with |getline()|. Thus "." is the current line, "'m" mark m, etc. + Can also be used as a |method|: > + GetLnum()->foldclosed() + foldclosedend({lnum}) *foldclosedend()* The result is a Number. If the line {lnum} is in a closed fold, the result is the number of the last line in that fold. @@ -4395,6 +4466,9 @@ foldclosedend({lnum}) *foldclosedend()* {lnum} is used like with |getline()|. Thus "." is the current line, "'m" mark m, etc. + Can also be used as a |method|: > + GetLnum()->foldclosedend() + foldlevel({lnum}) *foldlevel()* The result is a Number, which is the foldlevel of line {lnum} in the current buffer. For nested folds the deepest level is @@ -4407,6 +4481,9 @@ foldlevel({lnum}) *foldlevel()* {lnum} is used like with |getline()|. Thus "." is the current line, "'m" mark m, etc. + Can also be used as a |method|: > + GetLnum()->foldlevel() + *foldtext()* foldtext() Returns a String, to be displayed for a closed fold. This is the default function used for the 'foldtext' option and should @@ -4432,6 +4509,9 @@ foldtextresult({lnum}) *foldtextresult()* line, "'m" mark m, etc. Useful when exporting folded text, e.g., to HTML. + Can also be used as a |method|: > + GetLnum()->foldtextresult() +< *foreground()* foreground() Move the Vim window to the foreground. Useful when sent from a client to a Vim server. |remote_send()| @@ -4450,6 +4530,9 @@ funcref({name} [, {arglist}] [, {dict}]) Also for autoloaded functions. {name} cannot be a builtin function. + Can also be used as a |method|: > + GetFuncname()->funcref([arg]) +< *function()* *E700* *E922* *E923* function({name} [, {arglist}] [, {dict}]) Return a |Funcref| variable that refers to function {name}. @@ -4499,7 +4582,9 @@ function({name} [, {arglist}] [, {dict}]) call Func(500) < Invokes the function as with: > call context.Callback('one', 500) - +< + Can also be used as a |method|: > + GetFuncname()->function([arg]) garbagecollect([{atexit}]) *garbagecollect()* Cleanup unused |Lists| and |Dictionaries| that have circular @@ -4639,6 +4724,9 @@ getbufline({buf}, {lnum} [, {end}]) Example: > :let lines = getbufline(bufnr("myfile"), 1, "$") +< Can also be used as a |method|: > + GetBufnr()->getbufline(lnum) + getbufvar({buf}, {varname} [, {def}]) *getbufvar()* The result is the value of option or local buffer variable {varname} in buffer {buf}. Note that the name without "b:" @@ -4659,8 +4747,11 @@ getbufvar({buf}, {varname} [, {def}]) *getbufvar()* Examples: > :let bufmodified = getbufvar(1, "&mod") :echo "todo myvar = " . getbufvar("todo", "myvar") + +< Can also be used as a |method|: > + GetBufnr()->getbufvar(varname) < -getchangelist({buf}) *getchangelist()* +getchangelist([{buf}]) *getchangelist()* Returns the |changelist| for the buffer {buf}. For the use of {buf}, see |bufname()| above. If buffer {buf} doesn't exist, an empty list is returned. @@ -4676,6 +4767,9 @@ getchangelist({buf}) *getchangelist()* position refers to the position in the list. For other buffers, it is set to the length of the list. + Can also be used as a |method|: > + GetBufnr()->getchangelist() + getchar([expr]) *getchar()* Get a single character from the user or input stream. If [expr] is omitted, wait until a character is available. @@ -4708,7 +4802,8 @@ getchar([expr]) *getchar()* When the user clicks a mouse button, the mouse event will be returned. The position can then be found in |v:mouse_col|, |v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|. - Mouse move events will be ignored. + |getmousepos()| can also be used. Mouse move events will be + ignored. This example positions the mouse as it would normally happen: > let c = getchar() if c == "\<LeftMouse>" && v:mouse_win > 0 @@ -4885,6 +4980,9 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* If there are no matches, an empty list is returned. An invalid value for {type} produces an error. + Can also be used as a |method|: > + GetPattern()->getcompletion('color') +< *getcurpos()* getcurpos() Get the position of the cursor. This is like getpos('.'), but includes an extra "curswant" in the list: @@ -4912,6 +5010,12 @@ getcwd([{winnr}[, {tabnr}]]) *getcwd()* getcwd(0, 0) < If {winnr} is -1 it is ignored, only the tab is resolved. {winnr} can be the window number or the |window-ID|. + If both {winnr} and {tabnr} are -1 the global working + directory is returned. + Throw error if the arguments are invalid. |E5000| |E5001| |E5002| + + Can also be used as a |method|: > + GetWinnr()->getcwd() getenv({name}) *getenv()* Return the value of environment variable {name}. The {name} @@ -4922,6 +5026,9 @@ getenv({name}) *getenv()* is different from a variable set to an empty string. See also |expr-env|. + Can also be used as a |method|: > + GetVarname()->getenv() + getfontname([{name}]) *getfontname()* Without an argument returns the name of the normal font being used. Like what is used for the Normal highlight group @@ -4949,6 +5056,9 @@ getfperm({fname}) *getfperm()* < This will hopefully (from a security point of view) display the string "rw-r--r--" or even "rw-------". + Can also be used as a |method|: > + GetFilename()->getfperm() +< For setting permissions use |setfperm()|. getfsize({fname}) *getfsize()* @@ -4959,6 +5069,9 @@ getfsize({fname}) *getfsize()* If the size of {fname} is too big to fit in a Number then -2 is returned. + Can also be used as a |method|: > + GetFilename()->getfsize() + getftime({fname}) *getftime()* The result is a Number, which is the last modification time of the given file {fname}. The value is measured as seconds @@ -4966,6 +5079,9 @@ getftime({fname}) *getftime()* |localtime()| and |strftime()|. If the file {fname} can't be found -1 is returned. + Can also be used as a |method|: > + GetFilename()->getftime() + getftype({fname}) *getftype()* The result is a String, which is a description of the kind of file of the given file {fname}. @@ -4986,6 +5102,9 @@ getftype({fname}) *getftype()* systems that support it. On some systems only "dir" and "file" are returned. + Can also be used as a |method|: > + GetFilename()->getftype() + getjumplist([{winnr} [, {tabnr}]]) *getjumplist()* Returns the |jumplist| for the specified window. @@ -5005,7 +5124,10 @@ getjumplist([{winnr} [, {tabnr}]]) *getjumplist()* filename filename if available lnum line number - *getline()* + Can also be used as a |method|: > + GetWinnr()->getjumplist() + +< *getline()* getline({lnum} [, {end}]) Without {end} the result is a String, which is line {lnum} from the current buffer. Example: > @@ -5028,6 +5150,9 @@ getline({lnum} [, {end}]) :let end = search("^$") - 1 :let lines = getline(start, end) +< Can also be used as a |method|: > + ComputeLnum()->getline() + < To get lines from another buffer see |getbufline()| getloclist({nr},[, {what}]) *getloclist()* @@ -5098,6 +5223,35 @@ getmatches([{win}]) *getmatches()* 'pattern': 'FIXME', 'priority': 10, 'id': 2}] > :unlet m < +getmousepos() *getmousepos()* + Returns a Dictionary with the last known position of the + mouse. This can be used in a mapping for a mouse click. The + items are: + screenrow screen row + screencol screen column + winid Window ID of the click + winrow row inside "winid" + wincol column inside "winid" + line text line inside "winid" + column text column inside "winid" + All numbers are 1-based. + + If not over a window, e.g. when in the command line, then only + "screenrow" and "screencol" are valid, the others are zero. + + When on the status line below a window or the vertical + separater right of a window, the "line" and "column" values + are zero. + + When the position is after the text then "column" is the + length of the text in bytes plus one. + + If the mouse is over a focusable floating window then that + window is used. + + When using |getchar()| the Vim variables |v:mouse_lnum|, + |v:mouse_col| and |v:mouse_winid| also provide these values. + *getpid()* getpid() Return a Number which is the process ID of the Vim process. This is a unique number, until Vim exits. @@ -5129,6 +5283,8 @@ getpos({expr}) Get the position for String {expr}. For possible values of call setpos("'a", save_a_mark) < Also see |getcurpos()| and |setpos()|. + Can also be used as a |method|: > + GetMark()->getpos() getqflist([{what}]) *getqflist()* Returns a |List| with all the current quickfix errors. Each @@ -5247,6 +5403,35 @@ getreg([{regname} [, 1 [, {list}]]]) *getreg()* If {regname} is not specified, |v:register| is used. + Can also be used as a |method|: > + GetRegname()->getreg() + +getreginfo([{regname}]) *getreginfo()* + Returns detailed information about register {regname} as a + Dictionary with the following entries: + regcontents List of lines contained in register + {regname}, like + |getreg|({regname}, 1, 1). + regtype the type of register {regname}, as in + |getregtype()|. + isunnamed Boolean flag, v:true if this register + is currently pointed to by the unnamed + register. + points_to for the unnamed register, gives the + single letter name of the register + currently pointed to (see |quotequote|). + For example, after deleting a line + with `dd`, this field will be "1", + which is the register that got the + deleted text. + + The {regname} argument is a string. If {regname} is invalid + or not set, an empty Dictionary will be returned. + If {regname} is not specified, |v:register| is used. + The returned Dictionary can be passed to |setreg()|. + + Can also be used as a |method|: > + GetRegname()->getreginfo() getregtype([{regname}]) *getregtype()* The result is a String, which is type of register {regname}. @@ -5259,6 +5444,9 @@ getregtype([{regname}]) *getregtype()* The {regname} argument is a string. If {regname} is not specified, |v:register| is used. + Can also be used as a |method|: > + GetRegname()->getregtype() + gettabinfo([{tabnr}]) *gettabinfo()* If {tabnr} is not specified, then information about all the tab pages is returned as a |List|. Each List item is a @@ -5272,6 +5460,9 @@ gettabinfo([{tabnr}]) *gettabinfo()* tabpage-local variables windows List of |window-ID|s in the tab page. + Can also be used as a |method|: > + GetTabnr()->gettabinfo() + gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* Get the value of a tab-local variable {varname} in tab page {tabnr}. |t:var| @@ -5282,6 +5473,9 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* When the tab or variable doesn't exist {def} or an empty string is returned, there is no error message. + Can also be used as a |method|: > + GetTabnr()->gettabvar(varname) + gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* Get the value of window-local variable {varname} in window {winnr} in tab page {tabnr}. @@ -5308,6 +5502,9 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* To obtain all window-local variables use: > gettabwinvar({tabnr}, {winnr}, '&') +< Can also be used as a |method|: > + GetTabnr()->gettabwinvar(winnr, varname) + gettagstack([{winnr}]) *gettagstack()* The result is a Dict, which is the tag stack of window {winnr}. {winnr} can be the window number or the |window-ID|. @@ -5336,6 +5533,9 @@ gettagstack([{winnr}]) *gettagstack()* See |tagstack| for more information about the tag stack. + Can also be used as a |method|: > + GetWinnr()->gettagstack() + getwininfo([{winid}]) *getwininfo()* Returns information about windows as a |List| with Dictionaries. @@ -5367,6 +5567,9 @@ getwininfo([{winid}]) *getwininfo()* winrow topmost screen line of the window; "row" from |win_screenpos()| + Can also be used as a |method|: > + GetWinnr()->getwininfo() + getwinpos([{timeout}]) *getwinpos()* The result is a |List| with two numbers, the result of |getwinposx()| and |getwinposy()| combined: @@ -5387,6 +5590,9 @@ getwinpos([{timeout}]) *getwinpos()* " Do some work here endwhile < + Can also be used as a |method|: > + GetTimeout()->getwinpos() +< *getwinposx()* getwinposx() The result is a Number, which is the X coordinate in pixels of the left hand side of the GUI Vim window. The result will be @@ -5404,6 +5610,9 @@ getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* Examples: > :let list_is_on = getwinvar(2, '&list') :echo "myvar = " . getwinvar(1, 'myvar') + +< Can also be used as a |method|: > + GetWinnr()->getwinvar(varname) < glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* Expand the file wildcards in {expr}. See |wildcards| for the @@ -5441,6 +5650,9 @@ glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* See |expand()| for expanding special Vim variables. See |system()| for getting the raw output of an external command. + Can also be used as a |method|: > + GetExpr()->glob() + glob2regpat({string}) *glob2regpat()* Convert a file pattern, as used by glob(), into a search pattern. The result can be used to match with a string that @@ -5453,7 +5665,9 @@ glob2regpat({string}) *glob2regpat()* Note that the result depends on the system. On MS-Windows a backslash usually means a path separator. - *globpath()* + Can also be used as a |method|: > + GetExpr()->glob2regpat() +< *globpath()* globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) Perform glob() for String {expr} on all directories in {path} and concatenate the results. Example: > @@ -5489,6 +5703,10 @@ globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) < Upwards search and limiting the depth of "**" is not supported, thus using 'path' will not always work properly. + Can also be used as a |method|, the base is passed as the + second argument: > + GetExpr()->globpath(&rtp) +< *has()* has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The {feature} argument is a feature name like "nvim-0.2.1" or @@ -5557,8 +5775,9 @@ has_key({dict}, {key}) *has_key()* 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. + The result is a Number, which is 1 when the window has set a + local path via |:lcd| or when {winnr} is -1 and the tabpage + has set a local path via |:tcd|, otherwise 0. Tabs and windows are identified by their respective numbers, 0 means current tab or window. Missing argument implies 0. @@ -5570,6 +5789,10 @@ haslocaldir([{winnr}[, {tabnr}]]) *haslocaldir()* With {winnr} and {tabnr} use the window in that tabpage. {winnr} can be the window number or the |window-ID|. If {winnr} is -1 it is ignored, only the tab is resolved. + Throw error if the arguments are invalid. |E5000| |E5001| |E5002| + + 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 @@ -5585,7 +5808,9 @@ hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* If no matching mapping is found FALSE is returned. The following characters are recognized in {mode}: n Normal mode - v Visual mode + v Visual and Select mode + x Visual mode + s Select mode o Operator-pending mode i Insert mode l Language-Argument ("r", "f", "t", etc.) @@ -5600,6 +5825,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* @@ -5621,6 +5849,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}. @@ -5652,6 +5884,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 @@ -5668,6 +5903,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}. @@ -5675,6 +5913,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 @@ -5683,6 +5924,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, @@ -5691,6 +5935,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 @@ -5709,6 +5956,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 @@ -5716,6 +5966,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 @@ -5736,6 +5988,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}) @@ -5848,6 +6102,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 @@ -5865,6 +6122,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 @@ -5890,6 +6150,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. @@ -5936,6 +6199,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. > @@ -5961,6 +6227,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 @@ -6145,6 +6414,9 @@ json_decode({expr}) *json_decode()* recommended and the only one required to be supported. Non-UTF-8 characters are an error. + Can also be used as a |method|: > + ReadObject()->json_decode() + json_encode({expr}) *json_encode()* Convert {expr} into a JSON string. Accepts |msgpack-special-dict| as the input. Will not convert @@ -6157,6 +6429,9 @@ json_encode({expr}) *json_encode()* or special escapes like "\t", other are dumped as-is. |Blob|s are converted to arrays of the individual bytes. + Can also be used as a |method|: > + GetObject()->json_encode() + keys({dict}) *keys()* Return a |List| with all the keys of {dict}. The |List| is in arbitrary order. Also see |items()| and |values()|. @@ -6220,6 +6495,10 @@ libcall({libname}, {funcname}, {argument}) object code must be compiled as position-independent ('PIC'). Examples: > :echo libcall("libc.so", "getenv", "HOME") + +< Can also be used as a |method|, where the base is passed as + the argument to the called function: > + GetValue()->libcall("libc.so", "getenv") < *libcallnr()* libcallnr({libname}, {funcname}, {argument}) @@ -6230,8 +6509,12 @@ libcallnr({libname}, {funcname}, {argument}) :call libcallnr("libc.so", "printf", "Hello World!\n") :call libcallnr("libc.so", "sleep", 10) < - *line()* -line({expr}) The result is a Number, which is the line number of the file + Can also be used as a |method|, where the base is passed as + the argument to the called function: > + GetValue()->libcallnr("libc.so", "printf") +< +line({expr} [, {winid}]) *line()* + The result is a Number, which is the line number of the file position given with {expr}. The {expr} argument is a string. The accepted positions are: . the cursor position @@ -6250,10 +6533,16 @@ line({expr}) The result is a Number, which is the line number of the file then applies to another buffer. To get the column number use |col()|. To get both use |getpos()|. + With the optional {winid} argument the values are obtained for + that window instead of the current window. Examples: > line(".") line number of the cursor + line(".", winid) idem, in window "winid" line("'t") line number of mark t line("'" . marker) line number of mark marker +< + Can also be used as a |method|: > + GetValue()->line() line2byte({lnum}) *line2byte()* Return the byte count from the start of the buffer for line @@ -6268,6 +6557,9 @@ line2byte({lnum}) *line2byte()* |getline()|. When {lnum} is invalid -1 is returned. Also see |byte2line()|, |go| and |:goto|. + Can also be used as a |method|: > + GetLnum()->line2byte() + lispindent({lnum}) *lispindent()* Get the amount of indent for line {lnum} according the lisp indenting rules, as with 'lisp'. @@ -6275,6 +6567,9 @@ lispindent({lnum}) *lispindent()* relevant. {lnum} is used just like in |getline()|. When {lnum} is invalid, -1 is returned. + Can also be used as a |method|: > + GetLnum()->lispindent() + list2str({list} [, {utf8}]) *list2str()* Convert each number in {list} to a character string can concatenate them all. Examples: > @@ -6284,11 +6579,14 @@ list2str({list} [, {utf8}]) *list2str()* join(map(list, {nr, val -> nr2char(val)}), '') < |str2list()| does the opposite. - When {utf8} is omitted or zero, the current 'encoding' is used. - With {utf8} is 1, always return utf-8 characters. - With utf-8 composing characters work as expected: > + UTF-8 encoding is always used, {utf8} option has no effect, + and exists only for backwards-compatibility. + With UTF-8 composing characters work as expected: > list2str([97, 769]) returns "á" < + Can also be used as a |method|: > + GetList()->list2str() + localtime() *localtime()* Return the current time, measured as seconds since 1st Jan 1970. See also |strftime()|, |strptime()| and |getftime()|. @@ -6323,6 +6621,9 @@ luaeval({expr}[, {expr}]) Evaluate Lua expression {expr} and return its result converted to Vim data structures. See |lua-eval| for more details. + Can also be used as a |method|: > + GetExpr()->luaeval() + map({expr1}, {expr2}) *map()* {expr1} must be a |List|, |Blob| or |Dictionary|. Replace each item in {expr1} with the result of evaluating @@ -6430,6 +6731,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 @@ -6464,6 +6767,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 @@ -6526,6 +6832,9 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()* zero matches at the start instead of a number of matches further down in the text. + 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 @@ -6581,6 +6890,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} @@ -6619,6 +6931,9 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) < Matches added by |matchaddpos()| are returned by |getmatches()|. + 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. @@ -6631,6 +6946,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, @@ -6639,6 +6957,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: > @@ -6658,6 +6979,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 @@ -6668,6 +6992,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") @@ -6681,6 +7008,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: > @@ -6699,6 +7029,9 @@ 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, @@ -6789,6 +7122,9 @@ mkdir({name} [, {path} [, {prot}]]) successful or FALSE if the directory creation failed or partly failed. + Can also be used as a |method|: > + GetName()->mkdir() +< *mode()* mode([expr]) Return a string that indicates the current mode. If [expr] is supplied and it evaluates to a non-zero Number or @@ -6804,30 +7140,34 @@ mode([expr]) Return a string that indicates the current mode. niI Normal using |i_CTRL-O| in |Insert-mode| niR Normal using |i_CTRL-O| in |Replace-mode| niV Normal using |i_CTRL-O| in |Virtual-Replace-mode| + nt Normal in |terminal-emulator| (insert goes to + Terminal mode) v Visual by character + vs Visual by character using |v_CTRL-O| in Select mode V Visual by line + Vs Visual by line using |v_CTRL-O| in Select mode CTRL-V Visual blockwise + CTRL-Vs Visual blockwise using |v_CTRL-O| in Select mode s Select by character S Select by line CTRL-S Select blockwise - vs Visual by character using |v_CTRL-O| from - Select mode - Vs Visual by line using |v_CTRL-O| from Select mode - CTRL-Vs Visual blockwise using |v_CTRL-O| from Select mode i Insert ic Insert mode completion |compl-generic| ix Insert mode |i_CTRL-X| completion R Replace |R| Rc Replace mode completion |compl-generic| - Rv Virtual Replace |gR| Rx Replace mode |i_CTRL-X| completion + Rv Virtual Replace |gR| + Rvc Virtual Replace mode completion |compl-generic| + Rvx Virtual Replace mode |i_CTRL-X| completion c Command-line editing cv Vim Ex mode |Q| or |gQ| r Hit-enter prompt rm The -- more -- prompt - r? |:confirm| query of some sort + r? A |:confirm| query of some sort ! Shell or external command is executing t Terminal mode: keys go to the job + This is useful in the 'statusline' option or when used with |remote_expr()| In most other places it always returns "c" or "n". @@ -6836,6 +7176,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() + msgpackdump({list} [, {type}]) *msgpackdump()* Convert a list of VimL objects to msgpack. Returned value is a |readfile()|-style list. When {type} contains "B", a |Blob| is @@ -6938,6 +7281,9 @@ nextnonblank({lnum}) *nextnonblank()* {lnum} is used like with |getline()|. See also |prevnonblank()|. + Can also be used as a |method|: > + GetLnum()->nextnonblank() + nr2char({expr} [, {utf8}]) *nr2char()* Return a string with a single character, which has the number value {expr}. Examples: > @@ -6952,6 +7298,9 @@ nr2char({expr} [, {utf8}]) *nr2char()* characters. nr2char(0) is a real NUL and terminates the string, thus results in an empty string. + Can also be used as a |method|: > + GetNumber()->nr2char() + nvim_...({...}) *E5555* *nvim_...()* *eval-api* Call nvim |api| functions. The type checking of arguments will be stricter than for most other builtins. For instance, @@ -6980,6 +7329,9 @@ pathshorten({path}) *pathshorten()* < ~/.c/n/a/file1.vim ~ It doesn't matter if the path exists or not. + Can also be used as a |method|: > + GetDirectories()->pathshorten() + perleval({expr}) *perleval()* Evaluate |perl| expression {expr} and return its result converted to Vim data structures. @@ -6995,6 +7347,9 @@ perleval({expr}) *perleval()* :echo perleval('[1 .. 4]') < [1, 2, 3, 4] + Can also be used as a |method|: > + GetExpr()->perleval() + pow({x}, {y}) *pow()* Return the power of {x} to the exponent {y} as a |Float|. {x} and {y} must evaluate to a |Float| or a |Number|. @@ -7018,6 +7373,8 @@ prevnonblank({lnum}) *prevnonblank()* {lnum} is used like with |getline()|. Also see |nextnonblank()|. + Can also be used as a |method|: > + GetLnum()->prevnonblank() printf({fmt}, {expr1} ...) *printf()* Return a String with {fmt}, where "%" items are replaced by @@ -7250,6 +7607,9 @@ prompt_setcallback({buf}, {expr}) *prompt_setcallback()* endif endfunc +< Can also be used as a |method|: > + GetBuffer()->prompt_setcallback(callback) + prompt_setinterrupt({buf}, {expr}) *prompt_setinterrupt()* Set a callback for buffer {buf} to {expr}. When {expr} is an empty string the callback is removed. This has only effect if @@ -7259,12 +7619,18 @@ prompt_setinterrupt({buf}, {expr}) *prompt_setinterrupt()* mode. Without setting a callback Vim will exit Insert mode, as in any buffer. + Can also be used as a |method|: > + GetBuffer()->prompt_setinterrupt(callback) + prompt_setprompt({buf}, {text}) *prompt_setprompt()* Set prompt for buffer {buf} to {text}. You most likely want {text} to end in a space. The result is only visible if {buf} has 'buftype' set to "prompt". Example: > call prompt_setprompt(bufnr(''), 'command: ') +< + Can also be used as a |method|: > + GetBuffer()->prompt_setprompt('command: ') pum_getpos() *pum_getpos()* If the popup menu (see |ins-completion-menu|) is not visible, @@ -7295,6 +7661,9 @@ py3eval({expr}) *py3eval()* Dictionaries are represented as Vim |Dictionary| type with keys converted to strings. + Can also be used as a |method|: > + GetExpr()->py3eval() +< *E858* *E859* pyeval({expr}) *pyeval()* Evaluate Python expression {expr} and return its result @@ -7305,12 +7674,18 @@ pyeval({expr}) *pyeval()* Dictionaries are represented as Vim |Dictionary| type, non-string keys result in error. + Can also be used as a |method|: > + GetExpr()->pyeval() + pyxeval({expr}) *pyxeval()* Evaluate Python expression {expr} and return its result converted to Vim data structures. Uses Python 2 or 3, see |python_x| and 'pyxversion'. See also: |pyeval()|, |py3eval()| + Can also be used as a |method|: > + GetExpr()->pyxeval() +< *E726* *E727* range({expr} [, {max} [, {stride}]]) *range()* Returns a |List| with Numbers: @@ -7330,6 +7705,9 @@ range({expr} [, {max} [, {stride}]]) *range()* range(0) " [] range(2, 0) " error! < + Can also be used as a |method|: > + GetExpr()->range() +< *readdir()* readdir({directory} [, {expr}]) Return a list with file and directory names in {directory}. @@ -7357,6 +7735,9 @@ readdir({directory} [, {expr}]) endfunction echo s:tree(".") < + Can also be used as a |method|: > + GetDirName()->readdir() +< *readfile()* readfile({fname} [, {type} [, {max}]]) Read file {fname} and return a |List|, each line of the file @@ -7390,6 +7771,9 @@ readfile({fname} [, {type} [, {max}]]) the result is an empty list. Also see |writefile()|. + Can also be used as a |method|: > + GetFileName()->readfile() + reg_executing() *reg_executing()* Returns the single letter name of the register being executed. Returns an empty string when no register is being executed. @@ -7417,6 +7801,9 @@ reltime([{start} [, {end}]]) *reltime()* The {start} and {end} arguments must be values returned by reltime(). + Can also be used as a |method|: > + GetStart()->reltime() +< Note: |localtime()| returns the current (non-relative) time. reltimefloat({time}) *reltimefloat()* @@ -7430,6 +7817,9 @@ reltimefloat({time}) *reltimefloat()* Also see |profiling|. If there is an error an empty string is returned + Can also be used as a |method|: > + reltime(start)->reltimefloat() + reltimestr({time}) *reltimestr()* Return a String that represents the time value of {time}. This is the number of seconds, a dot and the number of @@ -7444,6 +7834,9 @@ reltimestr({time}) *reltimestr()* < Also see |profiling|. If there is an error an empty string is returned + Can also be used as a |method|: > + reltime(start)->reltimestr() +< *remote_expr()* *E449* remote_expr({server}, {string} [, {idvar} [, {timeout}]]) Send the {string} to {server}. The string is sent as an @@ -7576,6 +7969,9 @@ rename({from}, {to}) *rename()* NOTE: If {to} exists it is overwritten without warning. This function is not available in the |sandbox|. + Can also be used as a |method|: > + GetOldName()->rename(newname) + repeat({expr}, {count}) *repeat()* Repeat {expr} {count} times and return the concatenated result. Example: > @@ -7602,6 +7998,9 @@ resolve({filename}) *resolve()* *E655* current directory (provided the result is still a relative path name) and also keeps a trailing path separator. + Can also be used as a |method|: > + GetName()->resolve() +< *reverse()* reverse({object}) Reverse the order of items in {object} in-place. @@ -7656,6 +8055,9 @@ rubyeval({expr}) *rubyeval()* Other objects are represented as strings resulted from their "Object#to_s" method. + Can also be used as a |method|: > + GetRubyExpr()->rubyeval() + screenattr({row}, {col}) *screenattr()* Like |screenchar()|, but return the attribute. This is a rather arbitrary number that can only be used to compare to the @@ -8219,6 +8621,9 @@ setfperm({fname}, {mode}) *setfperm()* *chmod* Returns non-zero for success, zero for failure. + Can also be used as a |method|: > + GetFilename()->setfperm(mode) +< To read permissions see |getfperm()|. setline({lnum}, {text}) *setline()* @@ -8435,8 +8840,8 @@ setreg({regname}, {value} [, {options}]) Set the register {regname} to {value}. The {regname} argument is a string. - {value} may be any value returned by |getreg()|, including - a |List|. + {value} may be any value returned by |getreg()| or + |getreginfo()|, including a |List| or |Dict|. If {options} contains "a" or {regname} is upper case, then the value is appended. @@ -8466,9 +8871,13 @@ setreg({regname}, {value} [, {options}]) :call setreg(v:register, @*) :call setreg('*', @%, 'ac') :call setreg('a', "1\n2\n3", 'b5') + :call setreg('"', { 'points_to': 'a'}) < This example shows using the functions to save and restore a register: > + :let var_a = getreginfo() + :call setreg('a', var_a) +< or: > :let var_a = getreg('a', 1, 1) :let var_amode = getregtype('a') .... @@ -8906,10 +9315,9 @@ str2list({string} [, {utf8}]) *str2list()* str2list("ABC") returns [65, 66, 67] < |list2str()| does the opposite. - When {utf8} is omitted or zero, the current 'encoding' is used. - With {utf8} set to TRUE, always treat the String as utf-8 - characters. With utf-8 composing characters are handled - properly: > + UTF-8 encoding is always used, {utf8} option has no effect, + and exists only for backwards-compatibility. + With UTF-8 composing characters are handled properly: > str2list("á") returns [97, 769] < Can also be used as a |method|: > @@ -10921,7 +11329,7 @@ text... literal then the items also cannot be changed: > const ll = [1, 2, 3] let ll[1] = 5 " Error! -< Nested references are not locked: > +< Nested references are not locked: > let lvar = ['a'] const lconst = [0, lvar] let lconst[0] = 2 " Error! |