Skip to content

Commit 08572c2

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 5dd3e59 + fee0c4a commit 08572c2

29 files changed

+15999
-10599
lines changed

runtime/doc/builtin.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,6 +2872,10 @@ fnamemodify({fname}, {mods}) *fnamemodify()*
28722872
/home/user/vim/vim/src
28732873
< If {mods} is empty or an unsupported modifier is used then
28742874
{fname} is returned.
2875+
When {fname} is empty then with {mods} ":h" returns ".", so
2876+
that `:cd` can be used with it. This is different from
2877+
expand('%:h') without a buffer name, which returns an empty
2878+
string.
28752879
Note: Environment variables don't work in {fname}, use
28762880
|expand()| first then.
28772881

runtime/doc/gui_x11.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,9 @@ Of these three, Vim uses PRIMARY when reading and writing the "* register
688688
|'clipboard'| of "autoselect"), and CLIPBOARD when reading and writing the "+
689689
register. Vim does not access the SECONDARY selection.
690690

691+
This applies both to the GUI and the terminal version. For non-X11 systems
692+
the plus and the star register both us the system clipboard.
693+
691694
Examples: (assuming the default option values)
692695
- Select a URL in Visual mode in Vim. Go to your browser and click the
693696
middle mouse button in the URL text field. The selected text will be

runtime/doc/intro.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,8 @@ Q Switch to "Ex" mode. This is a bit like typing ":"
697697
line-input editing commands (<Del> or <BS> to erase,
698698
CTRL-U to kill the whole line).
699699
Vim will enter this mode by default if it's invoked as
700-
"ex" on the command-line.
700+
"ex" on the command-line or the |-e| command line
701+
argument was used.
701702
Use the ":vi" command |:visual| to exit "Ex" mode.
702703
Note: In older versions of Vim "Q" formatted text,
703704
that is now done with |gq|. But if you use the
@@ -708,7 +709,7 @@ Q Switch to "Ex" mode. This is a bit like typing ":"
708709
gQ Switch to "Ex" mode like with "Q", but really behave
709710
like typing ":" commands after another. All command
710711
line editing, completion etc. is available.
711-
Use the ":vi" command |:visual| to exit "Ex" mode.
712+
Use the `:vi` command (`:visual`) to exit "Ex" mode.
712713

713714
==============================================================================
714715
7. The window contents *window-contents*

runtime/doc/map.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,15 +374,17 @@ command: it is executed as if an (unrestricted) |autocommand| was invoked.
374374
<ScriptCmd> is like <Cmd> but sets the context to the script the mapping was
375375
defined in, for the duration of the command execution. This is especially
376376
useful for |Vim9| script. It also works to access an import, which is useful
377-
in a plugin using an autoload script: >
377+
in a plugin using a, possibly autoloaded, script: >
378378
vim9script
379379
import autoload 'implementation.vim' as impl
380380
nnoremap <F4> <ScriptCmd>impl.DoTheWork()<CR>
381-
381+
<
382382
No matter where <F4> is typed, the "impl" import will be found in the script
383-
context of where the mapping was defined. And since it's an autoload import,
384-
the "implementation.vim" script will only be loaded once <F4> is typed, not
385-
when the mapping is defined.
383+
context of where the mapping was defined. When it's an autoload import, as in
384+
the example, the "implementation.vim" script will only be loaded once <F4> is
385+
typed, not when the mapping is defined.
386+
387+
Without <ScriptCmd> using "s:impl" would result in "E121: Undefined variable".
386388

387389
Note:
388390
- Because <Cmd> and <ScriptCmd> avoid mode-changes it does not trigger

runtime/doc/options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ A jump table for the options with a short description can be found at |Q_op|.
16821682
feature is included}
16831683
This option is a list of comma-separated names.
16841684
Note: if one of the items is "exclude:", then you can't add an item
1685-
after that. Therefore do append an item with += but use ^= to
1685+
after that. Therefore do not append an item with += but use ^= to
16861686
prepend, e.g.: >
16871687
set clipboard^=unnamed
16881688
< These names are recognized:

runtime/doc/tags

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7975,6 +7975,7 @@ if_sniff.txt if_sniff.txt /*if_sniff.txt*
79757975
if_tcl.txt if_tcl.txt /*if_tcl.txt*
79767976
ignore-errors eval.txt /*ignore-errors*
79777977
ignore-timestamp editing.txt /*ignore-timestamp*
7978+
import-legacy vim9.txt /*import-legacy*
79787979
improved-autocmds-5.4 version5.txt /*improved-autocmds-5.4*
79797980
improved-quickfix version5.txt /*improved-quickfix*
79807981
improved-sessions version5.txt /*improved-sessions*
@@ -8164,6 +8165,7 @@ lcs-space options.txt /*lcs-space*
81648165
lcs-tab options.txt /*lcs-tab*
81658166
lcs-trail options.txt /*lcs-trail*
81668167
left-right-motions motion.txt /*left-right-motions*
8168+
legacy-import vim9.txt /*legacy-import*
81678169
len() builtin.txt /*len()*
81688170
less various.txt /*less*
81698171
letter print.txt /*letter*

runtime/doc/term.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -633,10 +633,13 @@ When the GUI is running 't_Co' is set to 16777216.
633633
*termcap-cursor-shape* *termcap-cursor-color*
634634
When Vim enters Insert mode the 't_SI' escape sequence is sent. When Vim
635635
enters Replace mode the 't_SR' escape sequence is sent if it is set, otherwise
636-
't_SI' is sent. When leaving Insert mode or Replace mode 't_EI' is used. This
637-
can be used to change the shape or color of the cursor in Insert or Replace
638-
mode. These are not standard termcap/terminfo entries, you need to set them
639-
yourself.
636+
't_SI' is sent. When leaving Insert mode or Replace mode 't_EI' is used.
637+
Note: When 't_EI' is not set then 't_SI' and 't_SR' will not be sent. And
638+
when 't_SI' or 't_SR' is not set then 't_EI' is sent only once.
639+
640+
This can be used to change the shape or color of the cursor in Insert or
641+
Replace mode. These are not standard termcap/terminfo entries, you need to set
642+
them yourself.
640643
Example for an xterm, this changes the color of the cursor: >
641644
if &term =~ "xterm"
642645
let &t_SI = "\<Esc>]12;purple\x7"

runtime/doc/todo.txt

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,16 @@ Further Vim9 improvements, possibly after launch:
6868
- Implement as part of an expression: ++expr, --expr, expr++, expr--.
6969

7070
Update list of features to vote on:
71-
- multiple cursors
72-
- built-in LSP support
73-
- virtual text, using text properties
74-
- start first line halfway, scroll per screen line
71+
- Remove Athena item (won't happen)
72+
- Remove "add open mode" (won't happen)
73+
- Remove "editing of a hidden buffer" (done)
74+
- Change "add IDE features" to "improve terminal debugger"
75+
- Change "diff/merge capability for CVS" to "CVS and git"
76+
- Remove "pre-compile them" from "improve the performance of Vim scripts"
77+
- Add: multiple cursors, edit text in more than one place at a time
78+
- Add: fast syntax highlighting with parser instead of regex patterns
79+
- Add: virtual text, text properties can insert text in the line
80+
- Add: start first line halfway, scroll per wrapped screen line
7581

7682
Popup windows:
7783
- Preview popup not properly updated when it overlaps with completion menu.
@@ -117,8 +123,6 @@ Text properties:
117123
if the priority is above a certain value? (#7392)
118124
Combining text property with 'cursorline' does not always work (Billie
119125
Cleek, #5533)
120-
- "C" works OK. "dd" fails to delete text property in a buffer with a single
121-
line.
122126
- Add text property that shifts text to make room for annotation (e.g.
123127
variable type). Like the opposite of conceal. Requires fixing the cursor
124128
positioning and mouse clicks as with conceal mode.
@@ -200,9 +204,6 @@ Terminal emulator window:
200204
Patches considered for including:
201205
- Add "-n" option to xxd. #10599 needs a test
202206
- allow for nesting of timeout, sketch in #10595
203-
- Patch to implement the vimtutor with a plugin: #6414
204-
Was originally written by Felipe Morales.
205-
- Patch to make fillchars global-local. (#5206)
206207

207208
Autoconf: must use autoconf 2.69, later version generates lots of warnings
208209
- try using autoconf 2.71 and fix all "obsolete" warnings
@@ -3757,7 +3758,9 @@ Printing:
37573758
Syntax highlighting:
37583759
Long term goal: faster, better, etc. Options:
37593760
- use treesitter, NeoVim uses it - Many people don't like it.
3760-
- use TextMate, vscode uses it. #9087 - possibly a long term solution
3761+
- use TextMate, vscode uses it. #9087 - Other people don't like it.
3762+
Vscode is asked to switch to treesitter:
3763+
https://github.com/microsoft/vscode/issues/50140
37613764
8 Make ":syn off" use 'runtimepath' instead of $VIMRUNTIME. (Gary Johnson)
37623765
Should do the same for ":syn on" and ":syn manual".
37633766
8 Support "containedin" argument for ":syn include", so that the defined

runtime/doc/vim9.txt

Lines changed: 62 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ Do not start a comment with #{, it looks like the legacy dictionary literal
145145
and produces an error where this might be confusing. #{{ or #{{{ are OK,
146146
these can be used to start a fold.
147147

148+
When starting to read a script file Vim doesn't know it is |Vim9| script until
149+
the `vim9script` command is found. Until that point you would need to use
150+
legacy comments: >
151+
" legacy comment
152+
vim9script
153+
# Vim9 comment
154+
155+
That looks ugly, better put `vim9script` in the very first line: >
156+
vim9script
157+
# Vim9 comment
158+
148159
In legacy Vim script # is also used for the alternate file name. In Vim9
149160
script you need to use %% instead. Instead of ## use %%% (stands for all
150161
arguments).
@@ -1687,21 +1698,34 @@ be exported. {not implemented yet: class, interface}
16871698
Import ~
16881699
*:import* *:imp* *E1094* *E1047* *E1262*
16891700
*E1048* *E1049* *E1053* *E1071* *E1236*
1690-
The exported items can be imported in another Vim9 script: >
1701+
The exported items can be imported in another script. The import syntax has
1702+
two forms. The simple form: >
1703+
import {filename}
1704+
<
1705+
Where {filename} is an expression that must evaluate to a string. In this
1706+
form the filename should end in ".vim" and the portion before ".vim" will
1707+
become the script local name of the namespace. For example: >
16911708
import "myscript.vim"
1692-
1693-
This makes each item available as "myscript.item".
1709+
<
1710+
This makes each exported item in "myscript.vim" available as "myscript.item".
16941711
*:import-as* *E1257* *E1261*
1695-
In case the name is long or ambiguous, another name can be specified: >
1696-
import "thatscript.vim" as that
1712+
In case the name is long or ambiguous, this form can be used to specify
1713+
another name: >
1714+
import {longfilename} as {name}
1715+
<
1716+
In this form {name} becomes a specific script local name for the imported
1717+
namespace. Therefore {name} must consist of letters, digits and '_', like
1718+
|internal-variables|. The {longfilename} expression must evaluate to any
1719+
filename. For example: >
1720+
import "thatscript.vim.v2" as that
16971721
< *E1060* *E1258* *E1259* *E1260*
1698-
Then you can use "that.EXPORTED_CONST", "that.someValue", etc. You are free
1699-
to choose the name "that". Use something that will be recognized as referring
1700-
to the imported script. Avoid command names, command modifiers and builtin
1701-
function names, because the name will shadow them.
1702-
If the name starts with a capital letter it can also shadow global user
1703-
commands and functions. Also, you cannot use the name for something else in
1704-
the script, such as a function or variable name.
1722+
Then you can use "that.item", etc. You are free to choose the name "that".
1723+
Use something that will be recognized as referring to the imported script.
1724+
Avoid command names, command modifiers and builtin function names, because the
1725+
name will shadow them. Better not start the name starts with a capital
1726+
letter, since it can then also shadow global user commands and functions.
1727+
Also, you cannot use the name for something else in the script, such as a
1728+
function or variable name.
17051729

17061730
In case the dot in the name is undesired, a local reference can be made for a
17071731
function: >
@@ -1714,15 +1738,6 @@ This does not work for variables, since the value would be copied once and
17141738
when changing the variable the copy will change, not the original variable.
17151739
You will need to use the full name, with the dot.
17161740

1717-
The full syntax of the command is:
1718-
import {filename} [as {name}]
1719-
Where {filename} is an expression that must evaluate to a string. Without the
1720-
"as {name}" part it must end in ".vim". {name} must consist of letters,
1721-
digits and '_', like |internal-variables|.
1722-
1723-
`:import` can also be used in legacy Vim script. The imported items still
1724-
become script-local, even when the "s:" prefix is not given.
1725-
17261741
`:import` can not be used in a function. Imported items are intended to exist
17271742
at the script level and only imported once.
17281743

@@ -1752,14 +1767,38 @@ line, there can be no line break: >
17521767
echo that
17531768
.name # Error!
17541769
1755-
To refer to a function in an imported script in a mapping, |<SID>| can be
1756-
used: >
1770+
When you've imported a function from one script into a vim9 script you can
1771+
refer to the imported function in a mapping by prefixing it with |<SID>|: >
17571772
noremap <silent> ,a :call <SID>name.Function()<CR>
17581773
17591774
When the mapping is defined "<SID>name." will be replaced with <SNR> and the
17601775
script ID of the imported script.
17611776
An even simpler solution is using |<ScriptCmd>|: >
17621777
noremap ,a <ScriptCmd>name.Function()<CR>
1778+
1779+
Note that this does not work for variables, only for functions.
1780+
1781+
*import-legacy* *legacy-import*
1782+
`:import` can also be used in legacy Vim script. The imported namespace still
1783+
becomes script-local, even when the "s:" prefix is not given. For example: >
1784+
import "myfile.vim"
1785+
call s:myfile.MyFunc()
1786+
1787+
And using the "as name" form: >
1788+
import "otherfile.vim9script" as that
1789+
call s:that.OtherFunc()
1790+
1791+
However, the namespace cannot be resolved on it's own: >
1792+
import "that.vim"
1793+
echo s:that
1794+
" ERROR: E1060: Expected dot after name: s:that
1795+
<
1796+
This also affects the use of |<SID>| in the legacy mapping context. Since
1797+
|<SID>| is only a valid prefix for a function and NOT for a namespace, you
1798+
cannot use it
1799+
to scope a function in a script local namespace. Instead of prefixing the
1800+
function with |<SID>| you should use|<ScriptCmd>|. For example: >
1801+
noremap ,a <ScriptCmd>:call s:that.OtherFunc()<CR>
17631802
<
17641803
*:import-cycle*
17651804
The `import` commands are executed when encountered. If script A imports

runtime/filetype.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" Vim support file to detect file types
22
"
33
" Maintainer: Bram Moolenaar <[email protected]>
4-
" Last Change: 2022 Jun 03
4+
" Last Change: 2022 Jul 5
55

66
" Listen very carefully, I will say this only once
77
if exists("did_load_filetypes")

0 commit comments

Comments
 (0)