1- *eval.txt* For Vim version 8.1. Last change: 2019 Jul 04
1+ *eval.txt* For Vim version 8.1. Last change: 2019 Jul 13
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -58,7 +58,9 @@ List An ordered sequence of items, see |List| for details.
5858
5959Dictionary An associative, unordered array: Each entry has a key and a
6060 value. | Dictionary |
61- Example: {'blue' : "#0000ff", 'red' : "#ff0000"}
61+ Examples:
62+ {'blue' : "#0000ff", 'red' : "#ff0000"}
63+ #{blue: "#0000ff", red: "#ff0000"}
6264
6365Funcref A reference to a function | Funcref | .
6466 Example: function("strlen")
@@ -477,8 +479,14 @@ only appear once. Examples: >
477479A key is always a String. You can use a Number, it will be converted to a
478480String automatically. Thus the String '4' and the number 4 will find the same
479481entry. Note that the String '04' and the Number 04 are different, since the
480- Number will be converted to the String '4'. The empty string can be used as a
481- key.
482+ Number will be converted to the String '4'. The empty string can also be used
483+ as a key.
484+ *literal-Dict*
485+ To avoid having to put quotes around every key the #{} form can be used. This
486+ does require the key to consist only of ASCII letters, digits, '-' and '_'.
487+ Example: >
488+ let mydict = #{zero: 0, one_key: 1, two-key: 2, 333: 3}
489+ Note that 333 here is the string "333". Empty keys are not possible with #{}.
482490
483491A value can be any expression. Using a Dictionary for a value creates a
484492nested Dictionary: >
@@ -2660,16 +2668,20 @@ shellescape({string} [, {special}])
26602668 command argument
26612669shiftwidth([{col} ]) Number effective value of 'shiftwidth'
26622670sign_define({name} [, {dict} ]) Number define or update a sign
2671+ sign_define({list} ) List define or update a list of signs
26632672sign_getdefined([{name} ]) List get a list of defined signs
26642673sign_getplaced([{expr} [, {dict} ]])
26652674 List get a list of placed signs
26662675sign_jump({id} , {group} , {expr} )
26672676 Number jump to a sign
26682677sign_place({id} , {group} , {name} , {expr} [, {dict} ])
26692678 Number place a sign
2679+ sign_placelist({list} ) List place a list of signs
26702680sign_undefine([{name} ]) Number undefine a sign
2681+ sign_undefine({list} ) List undefine a list of signs
26712682sign_unplace({group} [, {dict} ])
26722683 Number unplace a sign
2684+ sign_unplacelist({list} ) List unplace a list of signs
26732685simplify({filename} ) String simplify filename as much as possible
26742686sin({expr} ) Float sine of {expr}
26752687sinh({expr} ) Float hyperbolic sine of {expr}
@@ -6494,6 +6506,8 @@ listener_flush([{buf}]) *listener_flush()*
64946506
64956507listener_remove({id} ) *listener_remove()*
64966508 Remove a listener previously added with listener_add().
6509+ Returns zero when {id} could not be found, one when {id} was
6510+ removed.
64976511
64986512localtime() *localtime()*
64996513 Return the current time, measured as seconds since 1st Jan
@@ -8624,6 +8638,7 @@ shiftwidth([{col}]) *shiftwidth()*
86248638 no {col} argument is given, column 1 will be assumed.
86258639
86268640sign_define({name} [, {dict} ]) *sign_define()*
8641+ sign_define({list} )
86278642 Define a new sign named {name} or modify the attributes of an
86288643 existing sign. This is similar to the | :sign-define | command.
86298644
@@ -8643,11 +8658,25 @@ sign_define({name} [, {dict}]) *sign_define()*
86438658 If the sign named {name} already exists, then the attributes
86448659 of the sign are updated.
86458660
8646- Returns 0 on success and -1 on failure.
8661+ The one argument {list} can be used to define a list of signs.
8662+ Each list item is a dictionary with the above items in {dict}
8663+ and a 'name' item for the sign name.
8664+
8665+ Returns 0 on success and -1 on failure. When the one argument
8666+ {list} is used, then returns a List of values one for each
8667+ defined sign.
86478668
86488669 Examples: >
8649- call sign_define("mySign", {"text" : "=>", "texthl" :
8650- \ "Error", "linehl" : "Search"})
8670+ call sign_define("mySign", {
8671+ \ "text" : "=>",
8672+ \ "texthl" : "Error",
8673+ \ "linehl" : "Search"})
8674+ call sign_define([
8675+ \ {'name' : 'sign1',
8676+ \ 'text' : '=>'},
8677+ \ {'name' : 'sign2',
8678+ \ 'text' : '!!'}
8679+ \ ])
86518680<
86528681sign_getdefined([{name} ]) *sign_getdefined()*
86538682 Get a list of defined signs and their attributes.
@@ -8800,18 +8829,86 @@ sign_place({id}, {group}, {name}, {expr} [, {dict}])
88008829 " at line 40 in buffer json.c with priority 90
88018830 call sign_place(10, 'g3', 'sign4', 'json.c',
88028831 \ {'lnum' : 40, 'priority' : 90})
8832+ <
8833+ *sign_placelist()*
8834+ sign_placelist({list} )
8835+ Place one or more signs. This is similar to the
8836+ | sign_place() | function. The {list} argument specifies the
8837+ List of signs to place. Each list item is a dict with the
8838+ following sign attributes:
8839+ buffer buffer name or number. For the accepted
8840+ values, see | bufname() | .
8841+ group sign group. {group} functions as a namespace
8842+ for {id} , thus two groups can use the same
8843+ IDs. If not specified or set to an empty
8844+ string, then the global group is used. See
8845+ | sign-group | for more information.
8846+ id sign identifier. If not specified or zero,
8847+ then a new unique identifier is allocated.
8848+ Otherwise the specified number is used. See
8849+ | sign-identifier | for more information.
8850+ lnum line number in the buffer {expr} where the
8851+ sign is to be placed. For the accepted values,
8852+ see | line() | .
8853+ name name of the sign to place. See | sign_define() |
8854+ for more information.
8855+ priority priority of the sign. When multiple signs are
8856+ placed on a line, the sign with the highest
8857+ priority is used. If not specified, the
8858+ default value of 10 is used. See
8859+ | sign-priority | for more information.
8860+
8861+ If {id} refers to an existing sign, then the existing sign is
8862+ modified to use the specified {name} and/or {priority} .
8863+
8864+ Returns a List of sign identifiers. If failed to place a
8865+ sign, the corresponding list item is set to -1.
8866+
8867+ Examples: >
8868+ " Place sign s1 with id 5 at line 20 and id 10 at line
8869+ " 30 in buffer a.c
8870+ let [n1, n2] = sign_place([
8871+ \ {'id' : 5,
8872+ \ 'name' : 's1',
8873+ \ 'buffer' : 'a.c',
8874+ \ 'lnum' : 20},
8875+ \ {'id' : 10,
8876+ \ 'name' : 's1',
8877+ \ 'buffer' : 'a.c',
8878+ \ 'lnum' : 30}
8879+ \ ])
8880+
8881+ " Place sign s1 in buffer a.c at line 40 and 50
8882+ " with auto-generated identifiers
8883+ let [n1, n2] = sign_place([
8884+ \ {'name' : 's1',
8885+ \ 'buffer' : 'a.c',
8886+ \ 'lnum' : 40},
8887+ \ {'name' : 's1',
8888+ \ 'buffer' : 'a.c',
8889+ \ 'lnum' : 50}
8890+ \ ])
88038891<
88048892sign_undefine([{name} ]) *sign_undefine()*
8893+ sign_undefine({list} )
88058894 Deletes a previously defined sign {name} . This is similar to
88068895 the | :sign-undefine | command. If {name} is not supplied, then
88078896 deletes all the defined signs.
88088897
8809- Returns 0 on success and -1 on failure.
8898+ The one argument {list} can be used to undefine a list of
8899+ signs. Each list item is the name of a sign.
8900+
8901+ Returns 0 on success and -1 on failure. For the one argument
8902+ {list} call, returns a list of values one for each undefined
8903+ sign.
88108904
88118905 Examples: >
88128906 " Delete a sign named mySign
88138907 call sign_undefine("mySign")
88148908
8909+ " Delete signs 'sign1' and 'sign2'
8910+ call sign_undefine(["sign1", "sign2"])
8911+
88158912 " Delete all the signs
88168913 call sign_undefine()
88178914<
@@ -8857,6 +8954,32 @@ sign_unplace({group} [, {dict}]) *sign_unplace()*
88578954 " Remove all the placed signs from all the buffers
88588955 call sign_unplace('*')
88598956<
8957+ sign_unplacelist({list} ) *sign_unplacelist()*
8958+ Remove previously placed signs from one or more buffers. This
8959+ is similar to the | sign_unplace() | function.
8960+
8961+ The {list} argument specifies the List of signs to remove.
8962+ Each list item is a dict with the following sign attributes:
8963+ buffer buffer name or number. For the accepted
8964+ values, see | bufname() | . If not specified,
8965+ then the specified sign is removed from all
8966+ the buffers.
8967+ group sign group name. If not specified or set to an
8968+ empty string, then the global sign group is
8969+ used. If set to '*', then all the groups
8970+ including the global group are used.
8971+ id sign identifier. If not specified, then all
8972+ the signs in the specified group are removed.
8973+
8974+ Returns a List where an entry is set to 0 if the corresponding
8975+ sign was successfully removed or -1 on failure.
8976+
8977+ Example: >
8978+ " Remove sign with id 10 from buffer a.vim and sign
8979+ " with id 20 from buffer b.vim
8980+ call sign_unplace([{'id' : 10, 'buffer' : "a.vim"},
8981+ \ {'id' : 20, 'buffer' : 'b.vim'}])
8982+ <
88608983simplify({filename} ) *simplify()*
88618984 Simplify the file name as much as possible without changing
88628985 the meaning. Shortcuts (on MS-Windows) or symbolic links (on
@@ -9917,8 +10040,8 @@ timer_stop({timer}) *timer_stop()*
991710040
991810041timer_stopall() *timer_stopall()*
991910042 Stop all timers. The timer callbacks will no longer be
9920- invoked. Useful if some timers is misbehaving. If there are
9921- no timers there is no error.
10043+ invoked. Useful if a timer is misbehaving. If there are no
10044+ timers there is no error.
992210045
992310046 {only available when compiled with the | +timers | feature}
992410047
0 commit comments