Update runtime files.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 4bab6ef..217e69d 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 8.2. Last change: 2021 Jan 13
+*eval.txt* For Vim version 8.2. Last change: 2021 Jan 17
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4084,8 +4084,9 @@
A symbolic link itself is deleted, not what it points to.
- The result is a Number, which is 0 if the delete operation was
- successful and -1 when the deletion failed or partly failed.
+ The result is a Number, which is 0/false if the delete
+ operation was successful and -1/true when the deletion failed
+ or partly failed.
Use |remove()| to delete an item from a |List|.
To delete a line from the buffer use |:delete| or
@@ -6222,8 +6223,8 @@
has_key({dict}, {key}) *has_key()*
- The result is a Number, which is 1 if |Dictionary| {dict} has
- an entry with key {key}. Zero otherwise.
+ The result is a Number, which is TRUE if |Dictionary| {dict}
+ has an entry with key {key}. FALSE otherwise.
Can also be used as a |method|: >
mydict->has_key(key)
@@ -6266,16 +6267,16 @@
GetWinnr()->haslocaldir()
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
- The result is a Number, which is 1 if there is a mapping that
- contains {what} in somewhere in the rhs (what it is mapped to)
- and this mapping exists in one of the modes indicated by
- {mode}.
+ The result is a Number, which is TRUE if there is a mapping
+ that contains {what} in somewhere in the rhs (what it is
+ mapped to) and this mapping exists in one of the modes
+ indicated by {mode}.
When {abbr} is there and it is |TRUE| use abbreviations
instead of mappings. Don't forget to specify Insert and/or
Command-line mode.
Both the global mappings and the mappings local to the current
buffer are checked for a match.
- If no matching mapping is found 0 is returned.
+ If no matching mapping is found FALSE is returned.
The following characters are recognized in {mode}:
n Normal mode
v Visual and Select mode
@@ -6311,8 +6312,8 @@
character is sufficient.
If {item} does already exist in the history, it will be
shifted to become the newest entry.
- The result is a Number: 1 if the operation was successful,
- otherwise 0 is returned.
+ The result is a Number: TRUE if the operation was successful,
+ otherwise FALSE is returned.
Example: >
:call histadd("input", strftime("%Y %b %d"))
@@ -6335,8 +6336,8 @@
an index, see |:history-indexing|. The respective entry will
be removed if it exists.
- The result is a Number: 1 for a successful operation,
- otherwise 0 is returned.
+ The result is TRUE for a successful operation, otherwise FALSE
+ is returned.
Examples:
Clear expression register history: >
@@ -6388,7 +6389,7 @@
GetHistory()->histnr()
<
hlexists({name}) *hlexists()*
- The result is a Number, which is non-zero if a highlight group
+ The result is a Number, which is TRUE if a highlight group
called {name} exists. This is when the group has been
defined in some way. Not necessarily when highlighting has
been defined for it, it may also have been used for a syntax
@@ -6561,7 +6562,7 @@
Restore typeahead that was saved with a previous |inputsave()|.
Should be called the same number of times inputsave() is
called. Calling it more often is harmless though.
- Returns 1 when there is nothing to restore, 0 otherwise.
+ Returns TRUE when there is nothing to restore, FALSE otherwise.
inputsave() *inputsave()*
Preserve typeahead (also from mappings) and clear it, so that
@@ -6569,7 +6570,7 @@
followed by a matching inputrestore() after the prompt. Can
be used several times, in which case there must be just as
many inputrestore() calls.
- Returns 1 when out of memory, 0 otherwise.
+ Returns TRUE when out of memory, FALSE otherwise.
inputsecret({prompt} [, {text}]) *inputsecret()*
This function acts much like the |input()| function with but
@@ -7045,7 +7046,7 @@
listener_remove({id}) *listener_remove()*
Remove a listener previously added with listener_add().
- Returns zero when {id} could not be found, one when {id} was
+ Returns FALSE when {id} could not be found, TRUE when {id} was
removed.
Can also be used as a |method|: >
@@ -7728,8 +7729,8 @@
flag is passed (since patch 8.0.1708). However, without the
"p" option the call will fail.
- The function result is a Number, which is 1 if the call was
- successful or 0 if the directory creation failed or partly
+ The function result is a Number, which is TRUE if the call was
+ successful or FALSE if the directory creation failed or partly
failed.
Not available on all systems. To check use: >
@@ -9205,6 +9206,7 @@
Send a reply string to {clientid}. The most recent {clientid}
that sent a string can be retrieved with expand("<client>").
{only available when compiled with the |+clientserver| feature}
+ Returns zero for success, -1 for failure.
Note:
This id has to be stored before the next command can be
received. I.e. before returning from the received command and
@@ -9342,8 +9344,8 @@
before inserting the resulting text.
When the number is too big the cursor is put at the end of the
line. A number smaller than one has undefined results.
- Returns 0 when successful, 1 when not editing the command
- line.
+ Returns FALSE when successful, TRUE when not editing the
+ command line.
Can also be used as a |method|: >
GetPos()->setcmdpos()
@@ -9402,8 +9404,8 @@
When {lnum} is just below the last line the {text} will be
added below the last line.
- If this succeeds, 0 is returned. If this fails (most likely
- because {lnum} is invalid) 1 is returned.
+ If this succeeds, FALSE is returned. If this fails (most likely
+ because {lnum} is invalid) TRUE is returned.
Example: >
:call setline(5, strftime("%c"))
@@ -11378,7 +11380,7 @@
win_gotoid({expr}) *win_gotoid()*
Go to window with ID {expr}. This may also change the current
tabpage.
- Return 1 if successful, 0 if the window cannot be found.
+ Return TRUE if successful, FALSE if the window cannot be found.
Can also be used as a |method|: >
GetWinid()->win_gotoid()
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index 19720e1..d3a4bde 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -147,6 +147,7 @@
*.w g:filetype_w |ft-cweb-syntax|
*.i g:filetype_i |ft-progress-syntax|
*.p g:filetype_p |ft-pascal-syntax|
+ *.pp g:filetype_pp |ft-pascal-syntax|
*.sh g:bash_is_sh |ft-sh-syntax|
*.tex g:tex_flavor |ft-tex-plugin|
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index aec4ca0..e5d29ad 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt* For Vim version 8.2. Last change: 2020 Oct 05
+*index.txt* For Vim version 8.2. Last change: 2021 Jan 15
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 2963193..8b655dc 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -3273,7 +3273,7 @@
See the 'endofline' option.
*'fkmap'* *'fk'* *'nofkmap'* *'nofk'*
-'fkmap' 'fk' boolean (default off) *E198*
+'fkmap' 'fk' boolean (default off)
global
{only available when compiled with the |+rightleft|
feature}
@@ -5221,7 +5221,7 @@
NOTE: This option is set to the Vi default value when 'compatible' is
set and to the Vim default value when 'compatible' is reset.
- *'mouse'* *E538*
+ *'mouse'*
'mouse' string (default "", "a" for GUI and Win32,
set to "a" or "nvi" in |defaults.vim|)
global
diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt
index 54302a9..005b57f 100644
--- a/runtime/doc/popup.txt
+++ b/runtime/doc/popup.txt
@@ -588,8 +588,6 @@
If you want to create a new buffer yourself use |bufadd()| and pass the buffer
number to popup_create().
-It is not possible to use the buffer of a terminal window. *E278* You CAN
-create a hidden terminal buffer and use that one in a popup window.
The second argument of |popup_create()| is a dictionary with options:
line Screen line where to position the popup. Can use a
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index c171a20..a2a12b0 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -2335,11 +2335,12 @@
PASCAL *pascal.vim* *ft-pascal-syntax*
-Files matching "*.p" could be Progress or Pascal. If the automatic detection
-doesn't work for you, or you don't edit Progress at all, use this in your
-startup vimrc: >
+Files matching "*.p" could be Progress or Pascal and those matching "*.pp"
+could be Puppet or Pascal. If the automatic detection doesn't work for you,
+or you only edit Pascal files, use this in your startup vimrc: >
- :let filetype_p = "pascal"
+ :let filetype_p = "pascal"
+ :let filetype_pp = "pascal"
The Pascal syntax file has been extended to take into account some extensions
provided by Turbo Pascal, Free Pascal Compiler and GNU Pascal Compiler.
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 1b36eb2..24cdded 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -1045,6 +1045,8 @@
't_da' term.txt /*'t_da'*
't_db' term.txt /*'t_db'*
't_dl' term.txt /*'t_dl'*
+'t_fd' term.txt /*'t_fd'*
+'t_fe' term.txt /*'t_fe'*
't_fs' term.txt /*'t_fs'*
't_k1' term.txt /*'t_k1'*
't_k2' term.txt /*'t_k2'*
@@ -3112,9 +3114,11 @@
:sip change.txt /*:sip*
:sir change.txt /*:sir*
:sl various.txt /*:sl*
+:sl! various.txt /*:sl!*
:sla windows.txt /*:sla*
:slast windows.txt /*:slast*
:sleep various.txt /*:sleep*
+:sleep! various.txt /*:sleep!*
:sm change.txt /*:sm*
:smagic change.txt /*:smagic*
:smap map.txt /*:smap*
@@ -4028,7 +4032,6 @@
E195 starting.txt /*E195*
E196 various.txt /*E196*
E197 mlang.txt /*E197*
-E198 options.txt /*E198*
E199 cmdline.txt /*E199*
E20 motion.txt /*E20*
E200 autocmd.txt /*E200*
@@ -4114,7 +4117,6 @@
E275 textprop.txt /*E275*
E276 eval.txt /*E276*
E277 remote.txt /*E277*
-E278 popup.txt /*E278*
E279 terminal.txt /*E279*
E28 syntax.txt /*E28*
E280 if_tcl.txt /*E280*
@@ -4180,7 +4182,6 @@
E338 editing.txt /*E338*
E339 message.txt /*E339*
E34 various.txt /*E34*
-E340 vi_diff.txt /*E340*
E341 message.txt /*E341*
E342 message.txt /*E342*
E343 options.txt /*E343*
@@ -4388,7 +4389,6 @@
E535 options.txt /*E535*
E536 options.txt /*E536*
E537 options.txt /*E537*
-E538 options.txt /*E538*
E539 options.txt /*E539*
E54 pattern.txt /*E54*
E540 options.txt /*E540*
@@ -6351,6 +6351,7 @@
expression-syntax eval.txt /*expression-syntax*
exrc starting.txt /*exrc*
extend() eval.txt /*extend()*
+extendnew() eval.txt /*extendnew()*
extension-removal cmdline.txt /*extension-removal*
extensions-improvements todo.txt /*extensions-improvements*
f motion.txt /*f*
@@ -8680,6 +8681,7 @@
read-messages insert.txt /*read-messages*
read-only-share editing.txt /*read-only-share*
read-stdin version5.txt /*read-stdin*
+readblob() eval.txt /*readblob()*
readdir() eval.txt /*readdir()*
readdirex() eval.txt /*readdirex()*
readfile() eval.txt /*readfile()*
@@ -8945,6 +8947,7 @@
skeleton autocmd.txt /*skeleton*
skip_defaults_vim starting.txt /*skip_defaults_vim*
slice eval.txt /*slice*
+slice() eval.txt /*slice()*
slow-fast-terminal term.txt /*slow-fast-terminal*
slow-start starting.txt /*slow-start*
slow-terminal term.txt /*slow-terminal*
@@ -9340,6 +9343,8 @@
t_f7 version4.txt /*t_f7*
t_f8 version4.txt /*t_f8*
t_f9 version4.txt /*t_f9*
+t_fd term.txt /*t_fd*
+t_fe term.txt /*t_fe*
t_float-variable eval.txt /*t_float-variable*
t_fs term.txt /*t_fs*
t_func-variable eval.txt /*t_func-variable*
@@ -9714,6 +9719,7 @@
type-mistakes tips.txt /*type-mistakes*
typecorr-settings usr_41.txt /*typecorr-settings*
typecorr.txt usr_41.txt /*typecorr.txt*
+typename() eval.txt /*typename()*
u undo.txt /*u*
uganda uganda.txt /*uganda*
uganda.txt uganda.txt /*uganda.txt*
@@ -10314,6 +10320,7 @@
xterm-copy-paste term.txt /*xterm-copy-paste*
xterm-cursor-keys term.txt /*xterm-cursor-keys*
xterm-end-home-keys term.txt /*xterm-end-home-keys*
+xterm-focus-event term.txt /*xterm-focus-event*
xterm-function-keys term.txt /*xterm-function-keys*
xterm-modifier-keys term.txt /*xterm-modifier-keys*
xterm-mouse options.txt /*xterm-mouse*
diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt
index 0456a8b..8eea4a5 100644
--- a/runtime/doc/term.txt
+++ b/runtime/doc/term.txt
@@ -1,4 +1,4 @@
-*term.txt* For Vim version 8.2. Last change: 2020 Dec 29
+*term.txt* For Vim version 8.2. Last change: 2021 Jan 14
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -373,9 +373,9 @@
t_Ri restore icon text from stack *t_Ri* *'t_Ri'*
t_TE end of "raw" mode *t_TE* *'t_TE'*
t_TI put terminal into "raw" mode *t_TI* *'t_TI'*
- t_fd disable focus-event tracking *t_TI* *'t_TI'*
+ t_fd disable focus-event tracking *t_fd* *'t_fd'*
|xterm-focus-event|
- t_fe enable focus-event tracking *t_TI* *'t_TI'*
+ t_fe enable focus-event tracking *t_fe* *'t_fe'*
|xterm-focus-event|
Some codes have a start, middle and end part. The start and end are defined
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 6e5fe4c..75133f7 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 8.2. Last change: 2021 Jan 11
+*todo.txt* For Vim version 8.2. Last change: 2021 Jan 17
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,15 +38,7 @@
*known-bugs*
-------------------- Known bugs and current work -----------------------
-no error for:
- echo extend([0], ['a', true])
-like it does for:
- echo extend([0], ['a'])
-At script level this does not give an error:
- echo map([0], (_, v) => [])
-Or:
- var l: list<number> = [0]
- echo map(l, (_, v) => [])
+test_autocmd failure in Windows: Something wrong with system()?
Vim9 - Make everything work:
- Expand `=expr` in :next, :argedit, :argadd, :argdelete, :drop
@@ -117,6 +109,8 @@
- compile "skip" argument of searchpair()
- compile "expr" and "call" expression of a channel in channel_exe_cmd()?
- give an error for "echo Func()" if Func() does not return anything.
+- Using "windo echo expr" does not accept a line break inside "expr" (in a
+ :def function and at script level in a not executed block). #7681
Once Vim9 is stable:
- Change the help to prefer Vim9 syntax where appropriate
@@ -287,6 +281,9 @@
Patch to implement the vimtutor with a plugin: #6414
Was originally written by Felipe Morales.
+Adding "10" to 'spellsuggest' causes spell suggestions to become very slow.
+(#4087)
+
Patch to find Python dll using registry key. (#7540)
Remove SPACE_IN_FILENAME ? It is only used for completion.
@@ -479,9 +476,6 @@
that entry is used. But instead it's always added. (#6210)
Add flag AL_FIND_ADD, if there is one argument find it in the list.
-Adding "10" to 'spellsuggest' causes spell suggestions to become very slow.
-(#4087)
-
behavior of i_CTRl-R_CTRL-R differs from documentation. (Paul Desmond Parker,
#5771)
@@ -556,14 +550,6 @@
gvim window (with focus follows mouse), then the K_FOCUSLOST key is put in the
input buffer. (#5302)
-xterm should be able to pass focus changes to Vim, so that Vim can check for
-buffers that changed. Perhaps in misc.c, function selectwindow().
-Xterm 224 supports it!
-Patch to make FocusGained and FocusLost work in modern terminals. (Hayaki
-Saito, 2013 Apr 24) Update 2016 Aug 12.
-Also see issue #609.
-We could add the enable/disable sequences to t_ti/t_te or t_ks/t_ke.
-
:buffer completion does not escape "+" properly and results in a regexp error.
(#5467)
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 5d4686a..965a977 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1,4 +1,4 @@
-*usr_41.txt* For Vim version 8.2. Last change: 2021 Jan 08
+*usr_41.txt* For Vim version 8.2. Last change: 2021 Jan 13
VIM USER MANUAL - by Bram Moolenaar
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index c116d69..729cde3 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt* For Vim version 8.2. Last change: 2020 Nov 16
+*various.txt* For Vim version 8.2. Last change: 2021 Jan 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -411,7 +411,7 @@
B *+mouse_sgr* Unix only: sgr mouse handling |sgr-mouse|
B *+mouse_urxvt* Unix only: urxvt mouse handling |urxvt-mouse|
N *+mouse_xterm* Unix only: xterm mouse handling |xterm-mouse|
-N *+multi_byte* 16 and 32 bit characters |multibyte|
+T *+multi_byte* Unicode support, 16 and 32 bit characters |multibyte|
*+multi_byte_ime* Win32 input method for multibyte chars |multibyte-ime|
N *+multi_lang* non-English language support |multi-lang|
m *+mzscheme* Mzscheme interface |mzscheme|
@@ -722,6 +722,9 @@
available when compiled with the |+netbeans_intg|
feature}
+ *:sl!* *:sleep!*
+:[N]sl[eep]! [N] [m] Same as above, but hide the cursor
+
*:xrestore* *:xr*
:xr[estore] [display] Reinitializes the connection to the X11 server. Useful
after the X server restarts, e.g. when running Vim for
diff --git a/runtime/doc/version6.txt b/runtime/doc/version6.txt
index 82405e7..6b9f1d9 100644
--- a/runtime/doc/version6.txt
+++ b/runtime/doc/version6.txt
@@ -9661,7 +9661,7 @@
Files: src/os_unix.c
Patch 6.2f.018
-Problem: Mac OS X 10.2: OK is defined to zero in cursus.h while Vim uses
+Problem: Mac OS X 10.2: OK is defined to zero in curses.h while Vim uses
one. Redefining it causes a warning message.
Solution: Undefine OK before defining it to one. (Taro Muraoka)
Files: src/vim.h
diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt
index c7c7f7e..0fb29e4 100644
--- a/runtime/doc/vi_diff.txt
+++ b/runtime/doc/vi_diff.txt
@@ -73,7 +73,7 @@
Vim has only a few limits for the files that can be edited {Vi: can not handle
<Nul> characters and characters above 128, has limited line length, many other
limits}.
- *E340*
+
Maximum line length 2147483647 characters. Longer lines are split.
Maximum number of lines 2147483647 lines.
Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index a7b91db..93c3ddd 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1,4 +1,4 @@
-*vim9.txt* For Vim version 8.2. Last change: 2021 Jan 10
+*vim9.txt* For Vim version 8.2. Last change: 2021 Jan 15
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -487,6 +487,9 @@
file "_cb: Func})" and exit. To avoid this kind of mistake in Vim9 script
there must be white space between most command names and the argument.
+However, the argument of a command that is a command won't be recognized. For
+example, after "windo echo expr" a line break inside "expr" will not be seen.
+
Notes:
- "enddef" cannot be used at the start of a continuation line, it ends the
@@ -527,17 +530,17 @@
considering that JavaScript uses this syntax, using the {} form for dictionary
literals is considered a much more useful syntax. In Vim9 script the {} form
uses literal keys: >
- let dict = {key: value}
+ var dict = {key: value}
This works for alphanumeric characters, underscore and dash. If you want to
use another character, use a single or double quoted string: >
- let dict = {'key with space': value}
- let dict = {"key\twith\ttabs": value}
- let dict = {'': value} # empty key
+ var dict = {'key with space': value}
+ var dict = {"key\twith\ttabs": value}
+ var dict = {'': value} # empty key
In case the key needs to be an expression, square brackets can be used, just
like in JavaScript: >
- let dict = {["key" .. nr]: value}
+ var dict = {["key" .. nr]: value}
No :xit, :t, :append, :change or :insert ~
@@ -552,6 +555,29 @@
The 'ignorecase' option is not used for comparators that use strings.
+For loop ~
+
+Legacy Vim script has some tricks to make a for loop over a list handle
+deleting items at the current or previous item. In Vim9 script it just uses
+the index, if items are deleted then items in the list will be skipped.
+Example legacy script: >
+ let l = [1, 2, 3, 4]
+ for i in l
+ echo i
+ call remove(l, index(l, i))
+ endfor
+Would echo:
+ 1
+ 2
+ 3
+ 4
+In compiled Vim9 script you get:
+ 1
+ 3
+Generally, you should not change the list that is iterated over. Make a copy
+first if needed.
+
+
White space ~
Vim9 script enforces proper use of white space. This is no longer allowed: >
@@ -576,15 +602,17 @@
White space is not allowed:
- Between a function name and the "(": >
- call Func (arg) # Error!
- call Func
+ Func (arg) # Error!
+ Func
\ (arg) # Error!
- call Func(arg) # OK
- call Func(
- \ arg) # OK
- call Func(
- \ arg # OK
- \ )
+ Func
+ (arg) # Error!
+ Func(arg) # OK
+ Func(
+ arg) # OK
+ Func(
+ arg # OK
+ )
Conditions and expressions ~
@@ -648,12 +676,13 @@
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
+Indexing a string with [idx] or [idx : idx] uses character indexes instead of
byte indexes. 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 'á'.
A negative index is counting from the end, "[-1]" is the last character.
+To exclude the last character use |slice()|.
If the index is out of range then an empty string results.
In legacy script "++var" and "--var" would be silently accepted and have no
@@ -670,21 +699,22 @@
be made. Here is a summary of what might be unexpected.
Ex command ranges need to be prefixed with a colon. >
- -> # legacy Vim: shifts the previous line to the right
- ->func() # Vim9: method call in continuation line
- :-> # Vim9: shifts the previous line to the right
+ -> legacy Vim: shifts the previous line to the right
+ ->func() Vim9: method call in a continuation line
+ :-> Vim9: shifts the previous line to the right
- %s/a/b # legacy Vim: substitute on all lines
+ %s/a/b legacy Vim: substitute on all lines
x = alongname
- % another # Vim9: line continuation without a backslash
- :%s/a/b # Vim9: substitute on all lines
- 'text'->func() # Vim9: method call
- :'t # legacy Vim: jump to mark m
+ % another Vim9: modulo operator in a continuation line
+ :%s/a/b Vim9: substitute on all lines
+ 't legacy Vim: jump to mark t
+ 'text'->func() Vim9: method call
+ :'t Vim9: jump to mark t
Some Ex commands can be confused with assignments in Vim9 script: >
- g:name = value # assignment
- g:pattern:cmd # invalid command - ERROR
- :g:pattern:cmd # :global command
+ g:name = value # assignment
+ g:pattern:cmd # invalid command - ERROR
+ :g:pattern:cmd # :global command
Functions defined with `:def` compile the whole function. Legacy functions
can bail out, and the following lines are not parsed: >
@@ -704,7 +734,7 @@
For a workaround, split it in two functions: >
func Maybe()
if has('feature')
- call MaybyInner()
+ call MaybeInner()
endif
endfunc
if has('feature')
@@ -720,7 +750,7 @@
endif
enddef
< *vim9-user-command*
-Another side effect of compiling a function is that the precense of a user
+Another side effect of compiling a function is that the presence of a user
command is checked at compile time. If the user command is defined later an
error will result. This works: >
command -nargs=1 MyCommand echom <q-args>
@@ -1090,7 +1120,7 @@
1. In the plugin define user commands, functions and/or mappings that refer to
an autoload script. >
- command -nargs=1 SearchForStuff call searchfor#Stuff(<f-args>)
+ command -nargs=1 SearchForStuff searchfor#Stuff(<f-args>)
< This goes in .../plugin/anyname.vim. "anyname.vim" can be freely chosen.
@@ -1183,12 +1213,12 @@
should be done at compile time. Postponing it to runtime makes the execution
slower and means mistakes are found only later. For example, when
encountering the "+" character and compiling this into a generic add
-instruction, at execution time the instruction would have to inspect the type
-of the arguments and decide what kind of addition to do. And when the
-type is dictionary throw an error. If the types are known to be numbers then
-an "add number" instruction can be used, which is faster. The error can be
-given at compile time, no error handling is needed at runtime, since adding
-two numbers cannot fail.
+instruction, at runtime the instruction would have to inspect the type of the
+arguments and decide what kind of addition to do. And when the type is
+dictionary throw an error. If the types are known to be numbers then an "add
+number" instruction can be used, which is faster. The error can be given at
+compile time, no error handling is needed at runtime, since adding two numbers
+cannot fail.
The syntax for types, using <type> for compound types, is similar to Java. It
is easy to understand and widely used. The type names are what were used in