commit 7d53982b7f7991e27ebffd5159de012d900a244c
parent 1fdacbb3e4e118c7bc3cd03ea16b21a68c7c9631
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 21 Aug 2025 08:35:30 +0800
vim-patch:84a343a: runtime(doc): correct another problem in :h items()
The returned value is only in arbitrary order for a Dict.
closes: vim/vim#18050
https://github.com/vim/vim/commit/84a343a6ed34995adc67c062b64533c1b0bf7fb1
Diffstat:
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/runtime/doc/vimfn.txt b/runtime/doc/vimfn.txt
@@ -5429,7 +5429,8 @@ items({expr}) *items()*
Each |List| item is a list with two items:
- for a |Dict|: the key and the value
- for a |List| or |String|: the index and the value
- The |List| is in arbitrary order.
+ The returned |List| is in arbitrary order for a |Dict|,
+ otherwise it's in ascending order of the index.
Also see |keys()| and |values()|.
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua
@@ -4912,7 +4912,8 @@ function vim.fn.isnan(expr) end
--- Each |List| item is a list with two items:
--- - for a |Dict|: the key and the value
--- - for a |List| or |String|: the index and the value
---- The |List| is in arbitrary order.
+--- The returned |List| is in arbitrary order for a |Dict|,
+--- otherwise it's in ascending order of the index.
---
--- Also see |keys()| and |values()|.
---
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
@@ -6061,7 +6061,8 @@ M.funcs = {
Each |List| item is a list with two items:
- for a |Dict|: the key and the value
- for a |List| or |String|: the index and the value
- The |List| is in arbitrary order.
+ The returned |List| is in arbitrary order for a |Dict|,
+ otherwise it's in ascending order of the index.
Also see |keys()| and |values()|.