diff options
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r-- | runtime/doc/eval.txt | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 574b9c9dd9..75ea2c7f42 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 9.1. Last change: 2024 Feb 05 +*eval.txt* For Vim version 9.1. Last change: 2024 Feb 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -425,6 +425,18 @@ 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: > + :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' |