aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/builtin.txt
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-17 09:43:00 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-08-17 11:21:10 +0800
commit8cbb2477cf70ea29105e3df17308e6d6a067c8e6 (patch)
treed0f81b872a4220930736f9e276b2eb4eac802f02 /runtime/doc/builtin.txt
parent22d9338afceae5f8ef3845f152dea07a19d512d1 (diff)
downloadrneovim-8cbb2477cf70ea29105e3df17308e6d6a067c8e6.tar.gz
rneovim-8cbb2477cf70ea29105e3df17308e6d6a067c8e6.tar.bz2
rneovim-8cbb2477cf70ea29105e3df17308e6d6a067c8e6.zip
vim-patch:8.2.1969: Vim9: map() may change the list or dict item type
Problem: Vim9: map() may change the list or dict item type. Solution: Add mapnew(). https://github.com/vim/vim/commit/ea696852e7abcdebaf7f17a7f23dc90df1f5e2ed Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime/doc/builtin.txt')
-rw-r--r--runtime/doc/builtin.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index bc5f0948e2..04c4ce60c3 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -4065,6 +4065,8 @@ map({expr1}, {expr2}) *map()*
{expr1} must be a |List|, |Blob| or |Dictionary|.
Replace each item in {expr1} with the result of evaluating
{expr2}. For a |Blob| each byte is replaced.
+ If the item type changes you may want to use |mapnew()| to
+ create a new List or Dictionary.
{expr2} must be a |string| or |Funcref|.
@@ -4205,6 +4207,11 @@ mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
< This avoids adding the "_vv" mapping when there already is a
mapping for "_v" or for "_vvv".
+mapnew({expr1}, {expr2}) *mapnew()*
+ Like |map()| but instead of replacing items in {expr1} a new
+ List or Dictionary is created and returned. {expr1} remains
+ unchanged.
+
mapset({mode}, {abbr}, {dict}) *mapset()*
Restore a mapping from a dictionary returned by |maparg()|.
{mode} and {abbr} should be the same as for the call to