Mercurial > vim
diff runtime/doc/eval.txt @ 17413:40417757dffd v8.1.1705
patch 8.1.1705: using ~{} for a literal dict is not nice
commit https://github.com/vim/vim/commit/4c6d90458baae843463f930fdc3fe4a7a2191d27
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jul 16 22:04:02 2019 +0200
patch 8.1.1705: using ~{} for a literal dict is not nice
Problem: Using ~{} for a literal dict is not nice.
Solution: Use #{} instead.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 16 Jul 2019 22:15:05 +0200 |
parents | 2558f90045e5 |
children | ca8e754bdd53 |
line wrap: on
line diff
--- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -60,7 +60,7 @@ Dictionary An associative, unordered arr value. |Dictionary| Examples: {'blue': "#0000ff", 'red': "#ff0000"} - ~{blue: "#0000ff", red: "#ff0000"} + #{blue: "#0000ff", red: "#ff0000"} Funcref A reference to a function |Funcref|. Example: function("strlen") @@ -482,11 +482,11 @@ entry. Note that the String '04' and th 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 +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. + 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 with #{}. A value can be any expression. Using a Dictionary for a value creates a nested Dictionary: >