forked from aniani/vim
patch 8.1.1683: dictionary with string keys is longer than needed
Problem: Dictionary with string keys is longer than needed.
Solution: Use *{key: val} for literaly keys.
This commit is contained in:
@@ -58,7 +58,9 @@ List An ordered sequence of items, see |List| for details.
|
||||
|
||||
Dictionary An associative, unordered array: Each entry has a key and a
|
||||
value. |Dictionary|
|
||||
Example: {'blue': "#0000ff", 'red': "#ff0000"}
|
||||
Examples:
|
||||
{'blue': "#0000ff", 'red': "#ff0000"}
|
||||
*{blue: "#0000ff", red: "#ff0000"}
|
||||
|
||||
Funcref A reference to a function |Funcref|.
|
||||
Example: function("strlen")
|
||||
@@ -477,8 +479,14 @@ only appear once. Examples: >
|
||||
A key is always a String. You can use a Number, it will be converted to a
|
||||
String automatically. Thus the String '4' and the number 4 will find the same
|
||||
entry. Note that the String '04' and the Number 04 are different, since the
|
||||
Number will be converted to the String '4'. The empty string can be used as a
|
||||
key.
|
||||
Number will be converted to the String '4'. The empty string can also be used
|
||||
as a key.
|
||||
*literal-Dict*
|
||||
To avoid having to put quotes around every key the *{} form can be used. This
|
||||
does require the key to consist only of ASCII letters, digits, '-' and '_'.
|
||||
Example: >
|
||||
let mydict = *{zero: 0, one_key: 1, two-key: 2, 333: 3}
|
||||
Note that 333 here is the string "333". Empty keys are not possible here.
|
||||
|
||||
A value can be any expression. Using a Dictionary for a value creates a
|
||||
nested Dictionary: >
|
||||
|
||||
Reference in New Issue
Block a user