diff options
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r-- | runtime/doc/eval.txt | 82 |
1 files changed, 67 insertions, 15 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 0a17521c08..4ff0636b61 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -391,7 +391,7 @@ example, to add up all the numbers in a list: > 1.4 Dictionaries ~ - *dict* *Dictionaries* *Dictionary* + *Dict* *dict* *Dictionaries* *Dictionary* A Dictionary is an associative array: Each entry has a key and a value. The entry can be located with the key. The entries are stored without a specific ordering. @@ -1535,6 +1535,15 @@ v:oldfiles List of file names that is loaded from the |shada| file on than String this will cause trouble. {only when compiled with the |+shada| feature} + *v:option_new* +v:option_new New value of the option. Valid while executing an |OptionSet| + autocommand. + *v:option_old* +v:option_old Old value of the option. Valid while executing an |OptionSet| + autocommand. + *v:option_type* +v:option_type Scope of the set command. Valid while executing an + |OptionSet| autocommand. Can be either "global" or "local" *v:operator* *operator-variable* v:operator The last operator given in Normal mode. This is a single character except for commands starting with <g> or <z>, @@ -1763,6 +1772,8 @@ cursor( {lnum}, {col} [, {off}]) cursor( {list}) Number move cursor to position in {list} deepcopy( {expr} [, {noref}]) any make a full copy of {expr} delete( {fname}) Number delete file {fname} +dictwatcheradd({dict}, {pattern}, {callback}) Start watching a dictionary +dictwatcherdel({dict}, {pattern}, {callback}) Stop watching a dictionary did_filetype() Number TRUE if FileType autocommand event used diff_filler( {lnum}) Number diff filler lines about {lnum} diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col} @@ -1870,10 +1881,13 @@ invert( {expr}) Number bitwise invert isdirectory( {directory}) Number TRUE if {directory} is a directory islocked( {expr}) Number TRUE if {expr} is locked items( {dict}) List key-value pairs in {dict} -job_close({job}) Closes a job with id {job} -job_send({job}, {data}) Writes {data} to {job}'s stdin -job_spawn({name}, {prog}[, {argv}]) - Spawns {prog} as a job associated with {name} +jobclose({job}[, {stream}]) Number Closes a job stream(s) +jobresize({job}, {width}, {height}) + Number Resize {job}'s pseudo terminal window +jobsend({job}, {data}) Number Writes {data} to {job}'s stdin +jobstart({cmd}[, {opts}]) Number Spawns {cmd} as a job +jobstop({job}) Number Stops a job +jobwait({ids}[, {timeout}]) Number Wait for a set of jobs join( {list} [, {sep}]) String join {list} items into one String keys( {dict}) List keys in {dict} len( {expr}) Number the length of {expr} @@ -2661,6 +2675,44 @@ delete({fname}) *delete()* To delete a line from the buffer use |:delete|. Use |:exe| when the line number is in a variable. +dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()* + Adds a watcher to a dictionary. A dictionary watcher is + identified by three components: + + - A dictionary({dict}); + - A key pattern({pattern}). + - A function({callback}). + + After this is called, every change on {dict} and on keys + matching {pattern} will result in {callback} being invoked. + + For now {pattern} only accepts very simple patterns that can + contain a '*' at the end of the string, in which case it will + match every key that begins with the substring before the '*'. + That means if '*' is not the last character of {pattern}, only + keys that are exactly equal as {pattern} will be matched. + + The {callback} receives three arguments: + + - The dictionary being watched. + - The key which changed. + - A dictionary containg the new and old values for the key. + + The type of change can be determined by examining the keys + present on the third argument: + + - If contains both `old` and `new`, the key was updated. + - If it contains only `new`, the key was added. + - If it contains only `old`, the key was deleted. + + This function can be used by plugins to implement options with + validation and parsing logic. + +dictwatcherdel({dict}, {pattern}, {callback}) *dictwatcherdel()* + Removes a watcher added with |dictwatcheradd()|. All three + arguments must match the ones passed to |dictwatcheradd()| in + order for the watcher to be successfully deleted. + *did_filetype()* did_filetype() Returns non-zero when autocommands are being executed and the FileType event has been triggered at least once. Can be used @@ -2959,6 +3011,8 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* {expr1} is changed when {expr2} is not empty. If necessary make a copy of {expr1} first. {expr2} remains unchanged. + When {expr1} is locked and {expr2} is not empty the operation + fails. Returns {expr1}. @@ -3441,7 +3495,7 @@ getfperm({fname}) *getfperm()* If a user does not have a given permission the flag for this is replaced with the string "-". Examples: > :echo getfperm("/etc/passwd") - :echo getfperm(expand("~/.vimrc")) + :echo getfperm(expand("~/.config/nvim/init.vim")) < This will hopefully (from a security point of view) display the string "rw-r--r--" or even "rw-------". @@ -4668,10 +4722,10 @@ msgpackdump({list}) {Nvim} *msgpackdump()* msgpackparse({list}) {Nvim} *msgpackparse()* Convert a |readfile()|-style list to a list of VimL objects. Example: > - let fname = expand('~/.nvim/shada/main.shada') + let fname = expand('~/.config/nvim/shada/main.shada') let mpack = readfile(fname, 'b') let shada_objects = msgpackparse(mpack) -< This will read ~/.nvim/shada/main.shada file to +< This will read ~/.config/nvim/shada/main.shada file to `shada_objects` list. Limitations: @@ -4770,8 +4824,8 @@ pathshorten({expr}) *pathshorten()* result. The tail, the file name, is kept as-is. The other components in the path are reduced to single letters. Leading '~' and '.' characters are kept. Example: > - :echo pathshorten('~/.vim/autoload/myfile.vim') -< ~/.v/a/myfile.vim ~ + :echo pathshorten('~/.config/nvim/autoload/file1.vim') +< ~/.v/a/file1.vim ~ It doesn't matter if the path exists or not. pow({x}, {y}) *pow()* @@ -6888,7 +6942,6 @@ fname_case Case in file names matters (for MS-DOS and Windows this is not present). folding Compiled with |folding| support. footer Compiled with GUI footer support. |gui-footer| -fork Compiled to use fork()/exec() instead of system(). gettext Compiled with message translation |multi-lang| gui Compiled with GUI enabled. gui_athena Compiled with Athena GUI. @@ -6947,7 +7000,6 @@ statusline Compiled with support for 'statusline', 'rulerformat' syntax Compiled with syntax highlighting support |syntax|. syntax_items There are active syntax highlighting items for the current buffer. -system Compiled to use system() instead of fork()/exec(). tag_binary Compiled with binary searching in tags files |tag-binary-search|. tag_old_static Compiled with support for old static tags @@ -7274,8 +7326,8 @@ like this: > When such a function is called, and it is not defined yet, Vim will search the "autoload" directories in 'runtimepath' for a script file called -"filename.vim". For example "~/.vim/autoload/filename.vim". That file should -then define the function like this: > +"filename.vim". For example "~/.config/nvim/autoload/filename.vim". That +file should then define the function like this: > function filename#funcname() echo "Done!" @@ -9080,7 +9132,7 @@ A few options contain an expression. When this expression is evaluated it may have to be done in the sandbox to avoid a security risk. But the sandbox is restrictive, thus this only happens when the option was set from an insecure location. Insecure in this context are: -- sourcing a .vimrc or .exrc in the current directory +- sourcing a .nvimrc or .exrc in the current directory - while executing in the sandbox - value coming from a modeline |