aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-01-01 07:27:46 +0000
committerSean Dewar <seandewar@users.noreply.github.com>2022-02-05 19:55:11 +0000
commit7002a3433bed7600ec02d64927ae0e77d077f34e (patch)
treeea9d586f0c4c56924991dd84d434880926bf1371 /runtime
parent92e92f02e7106fcad1597bb8f0edf1e43186a07f (diff)
downloadrneovim-7002a3433bed7600ec02d64927ae0e77d077f34e.tar.gz
rneovim-7002a3433bed7600ec02d64927ae0e77d077f34e.tar.bz2
rneovim-7002a3433bed7600ec02d64927ae0e77d077f34e.zip
vim-patch:8.2.2658: :for cannot loop over a string
Problem: :for cannot loop over a string. Solution: Accept a string argument and iterate over its characters. https://github.com/vim/vim/commit/74e54fcb447e5db32f9c2df34c0554bbecdccca2 v8.2.2659 is already ported. N/A patches for version.c: vim-patch:8.2.2736: Vim9: for loop over string is a bit slow Problem: Vim9: for loop over string is a bit slow. Solution: Avoid using strlen(). https://github.com/vim/vim/commit/175a41c13f3e27e30c662f2f418c5a347dbc645d
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index d6486073cf..aa6d994857 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -372,8 +372,8 @@ Changing the order of items in a list: >
For loop ~
-The |:for| loop executes commands for each item in a |List| or |Blob|.
-A variable is set to each item in the sequence. Example with a List: >
+The |:for| loop executes commands for each item in a |List|, |String| or |Blob|.
+A variable is set to each item in sequence. Example with a List: >
:for item in mylist
: call Doit(item)
:endfor
@@ -390,7 +390,7 @@ If all you want to do is modify each item in the list then the |map()|
function will be a simpler method than a for loop.
Just like the |:let| command, |:for| also accepts a list of variables. This
-requires the argument to be a list of lists. >
+requires the argument to be a List of Lists. >
:for [lnum, col] in [[1, 3], [2, 8], [3, 0]]
: call Doit(lnum, col)
:endfor
@@ -408,6 +408,12 @@ It is also possible to put remaining items in a List variable: >
For a Blob one byte at a time is used.
+For a String one character, including any composing characters, is used as a
+String. Example: >
+ for c in text
+ echo 'This character is ' .. c
+ endfor
+
List functions ~
*E714*