aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/eval.txt
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-04 18:29:18 +0800
committerGitHub <noreply@github.com>2023-05-04 18:29:18 +0800
commit7ae57435be1af17cfb053087e08c6ba313522990 (patch)
treeb198a34d1a29f25bb8d2f207f857be06a7838d8d /runtime/doc/eval.txt
parent38f9ee63660740ce1976173a8513b57bc41d94a3 (diff)
parent8752da89b83281426e81e5c4a392308848f4bfb6 (diff)
downloadrneovim-7ae57435be1af17cfb053087e08c6ba313522990.tar.gz
rneovim-7ae57435be1af17cfb053087e08c6ba313522990.tar.bz2
rneovim-7ae57435be1af17cfb053087e08c6ba313522990.zip
Merge pull request #23470 from zeertzjq/vim-8.2.2344
vim-patch:8.2.{1461,1462,1466,2344,2607,2756}
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r--runtime/doc/eval.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 0c18fd5b4e..05fdf2f5bb 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -270,6 +270,9 @@ similar to -1. >
:let shortlist = mylist[2:2] " List with one item: [3]
:let otherlist = mylist[:] " make a copy of the List
+Notice that the last index is inclusive. If you prefer using an exclusive
+index use the |slice()| method.
+
If the first index is beyond the last item of the List or the second item is
before the first item, the result is an empty list. There is no error
message.
@@ -1152,6 +1155,8 @@ text column numbers start with one! Example, to get the byte under the
cursor: >
:let c = getline(".")[col(".") - 1]
+Index zero gives the first byte. Careful: text column numbers start with one!
+
If the length of the String is less than the index, the result is an empty
String. A negative index always results in an empty string (reason: backward
compatibility). Use [-1:] to get the last byte.
@@ -1176,6 +1181,9 @@ In legacy Vim script the indexes are byte indexes. This doesn't recognize
multibyte encodings, see |byteidx()| for computing the indexes. If expr8 is
a Number it is first converted to a String.
+The item at index expr1b is included, it is inclusive. For an exclusive index
+use the |slice()| function.
+
If expr1a is omitted zero is used. If expr1b is omitted the length of the
string minus one is used.