aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/eval.txt8
-rw-r--r--src/nvim/eval.c6
-rw-r--r--src/nvim/testdir/test_listdict.vim2
3 files changed, 8 insertions, 8 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 5b4c202215..0f848d0c27 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -40,7 +40,7 @@ Dictionary An associative, unordered array: Each entry has a key and a
value. |Dictionary|
Examples:
{'blue': "#0000ff", 'red': "#ff0000"}
- ~{blue: "#0000ff", red: "#ff0000"}
+ #{blue: "#0000ff", red: "#ff0000"}
The Number and String types are converted automatically, depending on how they
are used.
@@ -441,11 +441,11 @@ 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 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: >
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index a4594d9ac8..a2490be355 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -3906,7 +3906,7 @@ static int eval6(char_u **arg, typval_T *rettv, int evaluate, int want_string)
// (expression) nested expression
// [expr, expr] List
// {key: val, key: val} Dictionary
-// ~{key: val, key: val} Dictionary with literal keys
+// #{key: val, key: val} Dictionary with literal keys
//
// Also handle:
// ! in front logical NOT
@@ -4014,8 +4014,8 @@ static int eval7(
case '[': ret = get_list_tv(arg, rettv, evaluate);
break;
- // Dictionary: ~{key: val, key: val}
- case '~':
+ // Dictionary: #{key: val, key: val}
+ case '#':
if ((*arg)[1] == '{') {
(*arg)++;
ret = dict_get_tv(arg, rettv, evaluate, true);
diff --git a/src/nvim/testdir/test_listdict.vim b/src/nvim/testdir/test_listdict.vim
index 28cbceef9a..31a8b48d37 100644
--- a/src/nvim/testdir/test_listdict.vim
+++ b/src/nvim/testdir/test_listdict.vim
@@ -281,7 +281,7 @@ func Test_dict_func_remove_in_use()
endfunc
func Test_dict_literal_keys()
- call assert_equal({'one': 1, 'two2': 2, '3three': 3, '44': 4}, ~{one: 1, two2: 2, 3three: 3, 44: 4},)
+ call assert_equal({'one': 1, 'two2': 2, '3three': 3, '44': 4}, #{one: 1, two2: 2, 3three: 3, 44: 4},)
" why *{} cannot be used
let blue = 'blue'