summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-03-14 18:40:19 +0100
committerBram Moolenaar <Bram@vim.org>2021-03-14 18:40:19 +0100
commit0289a093a4d65c6280a3be118d1d3696d1aa74da (patch)
treef3ba35c77e5af05beeb3befbe64c0f13078029c5 /runtime
parent240309c9bfa8a0d2f154712f8e0dd33589f181d3 (diff)
patch 8.2.2605: Vim9: string index and slice does not include composing charsv8.2.2605
Problem: Vim9: string index and slice does not include composing chars. Solution: Include composing characters. (issue #6563)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/vim9.txt14
1 files changed, 9 insertions, 5 deletions
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index 20689ef58f..34048ece8e 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -96,8 +96,8 @@ script and `:def` functions; details are below:
def CallMe(count: number, message: string): bool
- Call functions without `:call`: >
writefile(['done'], 'file.txt')
-- You cannot use `:xit`, `:t`, `:k`, `:append`, `:change`, `:insert` or
- curly-braces names.
+- You cannot use `:xit`, `:t`, `:k`, `:append`, `:change`, `:insert`, `:open`
+ or curly-braces names.
- A range before a command must be prefixed with a colon: >
:%s/this/that
- Unless mentioned specifically, the highest |scriptversion| is used.
@@ -341,7 +341,8 @@ Functions can be called without `:call`: >
Using `:call` is still possible, but this is discouraged.
A method call without `eval` is possible, so long as the start is an
-identifier or can't be an Ex command. Examples: >
+identifier or can't be an Ex command. For a function either "(" or "->" must
+be following, without a line break. Examples: >
myList->add(123)
g:myList->add(123)
[1, 2, 3]->Process()
@@ -696,8 +697,9 @@ for v:null. When converting a boolean to a string "false" and "true" are
used, not "v:false" and "v:true" like in legacy script. "v:none" is not
changed, it is only used in JSON and has no equivalent in other languages.
-Indexing a string with [idx] or [idx : idx] uses character indexes instead of
-byte indexes. Example: >
+Indexing a string with [idx] or taking a slice with [idx : idx] uses character
+indexes instead of byte indexes. Composing characters are included.
+Example: >
echo 'bár'[1]
In legacy script this results in the character 0xc3 (an illegal byte), in Vim9
script this results in the string 'á'.
@@ -845,6 +847,8 @@ THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE
:enddef End of a function defined with `:def`. It should be on
a line by its own.
+You may also find this wiki useful. It was written by an early adoptor of
+Vim9 script: https://github.com/lacygoill/wiki/blob/master/vim/vim9.md
If the script the function is defined in is Vim9 script, then script-local
variables can be accessed without the "s:" prefix. They must be defined