1
0
forked from aniani/vim

Update runtime files

This commit is contained in:
Bram Moolenaar
2022-07-06 13:18:11 +01:00
parent cf34434b5e
commit 5ed11535e0
14 changed files with 506 additions and 336 deletions

View File

@@ -2872,6 +2872,10 @@ fnamemodify({fname}, {mods}) *fnamemodify()*
/home/user/vim/vim/src
< If {mods} is empty or an unsupported modifier is used then
{fname} is returned.
When {fname} is empty then with {mods} ":h" returns ".", so
that `:cd` can be used with it. This is different from
expand('%:h') without a buffer name, which returns an empty
string.
Note: Environment variables don't work in {fname}, use
|expand()| first then.

View File

@@ -697,7 +697,8 @@ Q Switch to "Ex" mode. This is a bit like typing ":"
line-input editing commands (<Del> or <BS> to erase,
CTRL-U to kill the whole line).
Vim will enter this mode by default if it's invoked as
"ex" on the command-line.
"ex" on the command-line or the |-e| command line
argument was used.
Use the ":vi" command |:visual| to exit "Ex" mode.
Note: In older versions of Vim "Q" formatted text,
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 ":"
gQ Switch to "Ex" mode like with "Q", but really behave
like typing ":" commands after another. All command
line editing, completion etc. is available.
Use the ":vi" command |:visual| to exit "Ex" mode.
Use the `:vi` command (`:visual`) to exit "Ex" mode.
==============================================================================
7. The window contents *window-contents*

View File

@@ -374,15 +374,17 @@ command: it is executed as if an (unrestricted) |autocommand| was invoked.
<ScriptCmd> is like <Cmd> but sets the context to the script the mapping was
defined in, for the duration of the command execution. This is especially
useful for |Vim9| script. It also works to access an import, which is useful
in a plugin using an autoload script: >
in a plugin using a, possibly autoloaded, script: >
vim9script
import autoload 'implementation.vim' as impl
nnoremap <F4> <ScriptCmd>impl.DoTheWork()<CR>
<
No matter where <F4> is typed, the "impl" import will be found in the script
context of where the mapping was defined. And since it's an autoload import,
the "implementation.vim" script will only be loaded once <F4> is typed, not
when the mapping is defined.
context of where the mapping was defined. When it's an autoload import, as in
the example, the "implementation.vim" script will only be loaded once <F4> is
typed, not when the mapping is defined.
Without <ScriptCmd> using "s:impl" would result in "E121: Undefined variable".
Note:
- Because <Cmd> and <ScriptCmd> avoid mode-changes it does not trigger

View File

@@ -1677,7 +1677,7 @@ A jump table for the options with a short description can be found at |Q_op|.
feature is included}
This option is a list of comma-separated names.
Note: if one of the items is "exclude:", then you can't add an item
after that. Therefore do append an item with += but use ^= to
after that. Therefore do not append an item with += but use ^= to
prepend, e.g.: >
set clipboard^=unnamed
< These names are recognized:

View File

@@ -7881,6 +7881,7 @@ if_sniff.txt if_sniff.txt /*if_sniff.txt*
if_tcl.txt if_tcl.txt /*if_tcl.txt*
ignore-errors eval.txt /*ignore-errors*
ignore-timestamp editing.txt /*ignore-timestamp*
import-legacy vim9.txt /*import-legacy*
improved-autocmds-5.4 version5.txt /*improved-autocmds-5.4*
improved-quickfix version5.txt /*improved-quickfix*
improved-sessions version5.txt /*improved-sessions*
@@ -8070,6 +8071,7 @@ lcs-space options.txt /*lcs-space*
lcs-tab options.txt /*lcs-tab*
lcs-trail options.txt /*lcs-trail*
left-right-motions motion.txt /*left-right-motions*
legacy-import vim9.txt /*legacy-import*
len() builtin.txt /*len()*
less various.txt /*less*
letter print.txt /*letter*

View File

@@ -633,10 +633,13 @@ When the GUI is running 't_Co' is set to 16777216.
*termcap-cursor-shape* *termcap-cursor-color*
When Vim enters Insert mode the 't_SI' escape sequence is sent. When Vim
enters Replace mode the 't_SR' escape sequence is sent if it is set, otherwise
't_SI' is sent. When leaving Insert mode or Replace mode 't_EI' is used. This
can be used to change the shape or color of the cursor in Insert or Replace
mode. These are not standard termcap/terminfo entries, you need to set them
yourself.
't_SI' is sent. When leaving Insert mode or Replace mode 't_EI' is used.
Note: When 't_EI' is not set then 't_SI' and 't_SR' will not be sent. And
when 't_SI' or 't_SR' is not set then 't_EI' is sent only once.
This can be used to change the shape or color of the cursor in Insert or
Replace mode. These are not standard termcap/terminfo entries, you need to set
them yourself.
Example for an xterm, this changes the color of the cursor: >
if &term =~ "xterm"
let &t_SI = "\<Esc>]12;purple\x7"

View File

@@ -68,6 +68,12 @@ Further Vim9 improvements, possibly after launch:
- Implement as part of an expression: ++expr, --expr, expr++, expr--.
Update list of features to vote on:
- Remove Athena item (won't happen)
- Remove "add open mode" (won't happen)
- Remove "editing of a hidden buffer" (done)
- Change "add IDE features" to "improve terminal debugger"
- Change "diff/merge capability for CVS" to "CVS and git"
- Remove "pre-compile them" from "improve the performance of Vim scripts"
- multiple cursors
- built-in LSP support
- virtual text, using text properties
@@ -117,8 +123,6 @@ Text properties:
if the priority is above a certain value? (#7392)
Combining text property with 'cursorline' does not always work (Billie
Cleek, #5533)
- "C" works OK. "dd" fails to delete text property in a buffer with a single
line.
- Add text property that shifts text to make room for annotation (e.g.
variable type). Like the opposite of conceal. Requires fixing the cursor
positioning and mouse clicks as with conceal mode.
@@ -200,9 +204,6 @@ Terminal emulator window:
Patches considered for including:
- Add "-n" option to xxd. #10599 needs a test
- allow for nesting of timeout, sketch in #10595
- Patch to implement the vimtutor with a plugin: #6414
Was originally written by Felipe Morales.
- Patch to make fillchars global-local. (#5206)
Autoconf: must use autoconf 2.69, later version generates lots of warnings
- try using autoconf 2.71 and fix all "obsolete" warnings

View File

@@ -145,6 +145,17 @@ Do not start a comment with #{, it looks like the legacy dictionary literal
and produces an error where this might be confusing. #{{ or #{{{ are OK,
these can be used to start a fold.
When starting to read a script file Vim doesn't know it is |Vim9| script until
the `vim9script` command is found. Until that point you would need to use
legacy comments: >
" legacy comment
vim9script
# Vim9 comment
That looks ugly, better put `vim9script` in the very first line: >
vim9script
# Vim9 comment
In legacy Vim script # is also used for the alternate file name. In Vim9
script you need to use %% instead. Instead of ## use %%% (stands for all
arguments).
@@ -1687,21 +1698,34 @@ be exported. {not implemented yet: class, interface}
Import ~
*:import* *:imp* *E1094* *E1047* *E1262*
*E1048* *E1049* *E1053* *E1071* *E1236*
The exported items can be imported in another Vim9 script: >
The exported items can be imported in another script. The import syntax has
two forms. The simple form: >
import {filename}
<
Where {filename} is an expression that must evaluate to a string. In this
form the filename should end in ".vim" and the portion before ".vim" will
become the script local name of the namespace. For example: >
import "myscript.vim"
This makes each item available as "myscript.item".
<
This makes each exported item in "myscript.vim" available as "myscript.item".
*:import-as* *E1257* *E1261*
In case the name is long or ambiguous, another name can be specified: >
import "thatscript.vim" as that
In case the name is long or ambiguous, this form can be used to specify
another name: >
import {longfilename} as {name}
<
In this form {name} becomes a specific script local name for the imported
namespace. Therefore {name} must consist of letters, digits and '_', like
|internal-variables|. The {longfilename} expression must evaluate to any
filename. For example: >
import "thatscript.vim.v2" as that
< *E1060* *E1258* *E1259* *E1260*
Then you can use "that.EXPORTED_CONST", "that.someValue", etc. You are free
to choose the name "that". Use something that will be recognized as referring
to the imported script. Avoid command names, command modifiers and builtin
function names, because the name will shadow them.
If the name starts with a capital letter it can also shadow global user
commands and functions. Also, you cannot use the name for something else in
the script, such as a function or variable name.
Then you can use "that.item", etc. You are free to choose the name "that".
Use something that will be recognized as referring to the imported script.
Avoid command names, command modifiers and builtin function names, because the
name will shadow them. Better not start the name starts with a capital
letter, since it can then also shadow global user commands and functions.
Also, you cannot use the name for something else in the script, such as a
function or variable name.
In case the dot in the name is undesired, a local reference can be made for a
function: >
@@ -1714,15 +1738,6 @@ This does not work for variables, since the value would be copied once and
when changing the variable the copy will change, not the original variable.
You will need to use the full name, with the dot.
The full syntax of the command is:
import {filename} [as {name}]
Where {filename} is an expression that must evaluate to a string. Without the
"as {name}" part it must end in ".vim". {name} must consist of letters,
digits and '_', like |internal-variables|.
`:import` can also be used in legacy Vim script. The imported items still
become script-local, even when the "s:" prefix is not given.
`:import` can not be used in a function. Imported items are intended to exist
at the script level and only imported once.
@@ -1752,14 +1767,38 @@ line, there can be no line break: >
echo that
.name # Error!
To refer to a function in an imported script in a mapping, |<SID>| can be
used: >
When you've imported a function from one script into a vim9 script you can
refer to the imported function in a mapping by prefixing it with |<SID>|: >
noremap <silent> ,a :call <SID>name.Function()<CR>
When the mapping is defined "<SID>name." will be replaced with <SNR> and the
script ID of the imported script.
An even simpler solution is using |<ScriptCmd>|: >
noremap ,a <ScriptCmd>name.Function()<CR>
Note that this does not work for variables, only for functions.
*import-legacy* *legacy-import*
`:import` can also be used in legacy Vim script. The imported namespace still
becomes script-local, even when the "s:" prefix is not given. For example: >
import "myfile.vim"
call s:myfile.MyFunc()
And using the "as name" form: >
import "otherfile.vim9script" as that
call s:that.OtherFunc()
However, the namespace cannot be resolved on it's own: >
import "that.vim"
echo s:that
" ERROR: E1060: Expected dot after name: s:that
<
This also affects the use of |<SID>| in the legacy mapping context. Since
|<SID>| is only a valid prefix for a function and NOT for a namespace, you
cannot use it
to scope a function in a script local namespace. Instead of prefixing the
function with |<SID>| you should use|<ScriptCmd>|. For example: >
noremap ,a <ScriptCmd>:call s:that.OtherFunc()<CR>
<
*:import-cycle*
The `import` commands are executed when encountered. If script A imports