diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-02-08 08:50:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-08 08:50:42 +0800 |
commit | 24d26b4cd1db3d312a6c6e9d025c0016159f99dc (patch) | |
tree | 456bc3cd94edd1612dbaf61d92f20d20be61aa9a | |
parent | 70a00492962d3201603056d00fbf87c785106d0d (diff) | |
parent | ceed5739e09debfb2f75017cdd673aa062bab045 (diff) | |
download | rneovim-24d26b4cd1db3d312a6c6e9d025c0016159f99dc.tar.gz rneovim-24d26b4cd1db3d312a6c6e9d025c0016159f99dc.tar.bz2 rneovim-24d26b4cd1db3d312a6c6e9d025c0016159f99dc.zip |
Merge pull request #27379 from zeertzjq/vim-9.1.0080
vim-patch:partial:9.1.0080,c9c2e2d2ff44
-rw-r--r-- | runtime/doc/eval.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 076d324b60..6f16f2ddfb 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -252,7 +252,9 @@ List concatenation ~ *list-concatenation* Two lists can be concatenated with the "+" operator: > :let longlist = mylist + [5, 6] +A list can be concatenated with another one in place using the "+=" operator or |extend()|: > :let mylist += [7, 8] + :call extend(mylist, [7, 8]) To prepend or append an item, turn the item into a list by putting [] around it. To change a list in-place, refer to |list-modification| below. @@ -374,6 +376,19 @@ To change part of a list you can specify the first and last item to be modified. The value must at least have the number of items in the range: > :let list[3:5] = [3, 4, 5] +To add items to a List in-place, you can use the += operator +|list-concatenation|: > + :let listA = [1, 2] + :let listA += [3, 4] +< +When two variables refer to the same List, changing one List in-place will +cause the referenced List to be changed in-place: > + :let listA = [1, 2] + :let listB = listA + :let listB += [3, 4] + :echo listA + [1, 2, 3, 4] +< Adding and removing items from a list is done with functions. Here are a few examples: > :call insert(list, 'a') " prepend item 'a' |