Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
131530a54d | ||
|
|
41114a2a27 | ||
|
|
83cd0156e0 | ||
|
|
0732932553 | ||
|
|
6e850a6900 | ||
|
|
2a4bd00cef | ||
|
|
81530e3603 | ||
|
|
d47c39775b | ||
|
|
53f7fccc94 | ||
|
|
327d3ee455 | ||
|
|
eaf3f36168 | ||
|
|
6868634abd | ||
|
|
78e006b9b0 | ||
|
|
e2390c7f32 | ||
|
|
7e6a2a64f0 |
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -51,6 +51,7 @@ runtime/compiler/sass.vim @tpope
|
||||
runtime/compiler/se.vim @dkearns
|
||||
runtime/compiler/shellcheck.vim @dkearns
|
||||
runtime/compiler/sml.vim @dkearns
|
||||
runtime/compiler/spectral.vim @romainl
|
||||
runtime/compiler/stylelint.vim @dkearns
|
||||
runtime/compiler/tcl.vim @dkearns
|
||||
runtime/compiler/tidy.vim @dkearns
|
||||
@@ -59,6 +60,7 @@ runtime/compiler/tsc.vim @dkearns
|
||||
runtime/compiler/typedoc.vim @dkearns
|
||||
runtime/compiler/xmllint.vim @dkearns
|
||||
runtime/compiler/xo.vim @dkearns
|
||||
runtime/compiler/yamllint.vim @romainl
|
||||
runtime/compiler/zsh.vim @dkearns
|
||||
runtime/doc/pi_getscript.txt @cecamp
|
||||
runtime/doc/pi_logipat.txt @cecamp
|
||||
|
||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -366,7 +366,7 @@ jobs:
|
||||
features: NORMAL
|
||||
|
||||
steps:
|
||||
- name: Initalize
|
||||
- name: Initialize
|
||||
id: init
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -45,14 +45,16 @@ full code is below):
|
||||
| Vim old | 5.018541 |
|
||||
| Python | 0.369598 |
|
||||
| Lua | 0.078817 |
|
||||
| LuaJit | 0.004245 |
|
||||
| Vim new | 0.073595 |
|
||||
|
||||
That looks very promising! It's just one example, but it shows how much
|
||||
we can gain, and also that Vim script can be faster than builtin
|
||||
interfaces.
|
||||
|
||||
In practice the script would not do something useless as counting but change
|
||||
the text. For example, reindent all the lines:
|
||||
LuaJit is much faster at Lua-only instructions. In practice the script would
|
||||
not do something useless as counting but change the text. For example,
|
||||
reindent all the lines:
|
||||
|
||||
``` vim
|
||||
let totallen = 0
|
||||
@@ -64,13 +66,17 @@ the text. For example, reindent all the lines:
|
||||
|
||||
| how | time in sec |
|
||||
| --------| -------- |
|
||||
| Vim old | 0.853752 |
|
||||
| Python | 0.304584 |
|
||||
| Lua | 0.286573 |
|
||||
| Vim new | 0.190276 |
|
||||
| Vim old | 0.578598 |
|
||||
| Python | 0.152040 |
|
||||
| Lua | 0.164917 |
|
||||
| LuaJit | 0.128400 |
|
||||
| Vim new | 0.079692 |
|
||||
|
||||
[These times were measured on a different system by Dominique Pelle]
|
||||
|
||||
The differences are smaller, but Vim 9 script is clearly the fastest.
|
||||
Using LuaJIT gives 0.25, only a little bit faster than plain Lua.
|
||||
Using LuaJIT is only a little bit faster than plain Lua here, clearly the call
|
||||
back to the Vim code is costly.
|
||||
|
||||
How does Vim9 script work? The function is first compiled into a sequence of
|
||||
instructions. Each instruction has one or two parameters and a stack is
|
||||
|
||||
17
runtime/compiler/spectral.vim
Normal file
17
runtime/compiler/spectral.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
" Vim compiler file
|
||||
" Compiler: Spectral for YAML
|
||||
" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
|
||||
" Last Change: 2021 July 21
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "spectral"
|
||||
|
||||
if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
CompilerSet makeprg=spectral\ lint\ %\ -f\ text
|
||||
CompilerSet errorformat=%f:%l:%c\ %t%.%\\{-}\ %m
|
||||
|
||||
16
runtime/compiler/yamllint.vim
Normal file
16
runtime/compiler/yamllint.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Vim compiler file
|
||||
" Compiler: Yamllint for YAML
|
||||
" Maintainer: Romain Lafourcade <romainlafourcade@gmail.com>
|
||||
" Last Change: 2021 July 21
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "yamllint"
|
||||
|
||||
if exists(":CompilerSet") != 2
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
CompilerSet makeprg=yamllint\ -f\ parsable
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*autocmd.txt* For Vim version 8.2. Last change: 2021 Jul 02
|
||||
*autocmd.txt* For Vim version 8.2. Last change: 2021 Jul 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -679,7 +679,8 @@ CursorHoldI Just like CursorHold, but in Insert mode.
|
||||
CursorMoved After the cursor was moved in Normal or Visual
|
||||
mode. Also when the text of the cursor line
|
||||
has been changed, e.g., with "x", "rx" or "p".
|
||||
Not triggered when there is typeahead, when
|
||||
Not triggered when there is typeahead, while
|
||||
executing commands in a script file, when
|
||||
an operator is pending or when moving to
|
||||
another window while remaining at the same
|
||||
cursor position.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*digraph.txt* For Vim version 8.2. Last change: 2020 Jul 16
|
||||
*digraph.txt* For Vim version 8.2. Last change: 2021 Jul 19
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*editing.txt* For Vim version 8.2. Last change: 2021 May 27
|
||||
*editing.txt* For Vim version 8.2. Last change: 2021 Jul 25
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1469,8 +1469,11 @@ be readable again. If you use a wrong key, it will be a mess.
|
||||
:X Prompt for an encryption key. The typing is done without showing the
|
||||
actual text, so that someone looking at the display won't see it.
|
||||
The typed key is stored in the 'key' option, which is used to encrypt
|
||||
the file when it is written. The file will remain unchanged until you
|
||||
write it. See also |-x|.
|
||||
the file when it is written.
|
||||
The file will remain unchanged until you write it. Note that commands
|
||||
such as `:xit` and `ZZ` will NOT write the file unless there are other
|
||||
changes.
|
||||
See also |-x|.
|
||||
|
||||
The value of the 'key' options is used when text is written. When the option
|
||||
is not empty, the written file will be encrypted, using the value as the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 8.2. Last change: 2021 Jul 01
|
||||
*eval.txt* For Vim version 8.2. Last change: 2021 Jul 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -3177,6 +3177,7 @@ append({lnum}, {text}) *append()*
|
||||
the current buffer.
|
||||
Any type of item is accepted and converted to a String.
|
||||
{lnum} can be zero to insert a line before the first one.
|
||||
{lnum} is used like with |getline()|.
|
||||
Returns 1 for failure ({lnum} out of range or out of memory),
|
||||
0 for success. Example: >
|
||||
:let failed = append(line('$'), "# THE END")
|
||||
@@ -3446,8 +3447,9 @@ bufloaded({expr}) *bufloaded()*
|
||||
let loaded = 'somename'->bufloaded()
|
||||
|
||||
bufname([{expr}]) *bufname()*
|
||||
The result is the name of a buffer, as it is displayed by the
|
||||
":ls" command.
|
||||
The result is the name of a buffer. Mostly as it is displayed
|
||||
by the `:ls` command, but not using special names such as
|
||||
"[No Name]".
|
||||
If {expr} is omitted the current buffer is used.
|
||||
If {expr} is a Number, that buffer number's name is given.
|
||||
Number zero is the alternate buffer for the current window.
|
||||
@@ -3482,7 +3484,7 @@ bufname([{expr}]) *bufname()*
|
||||
*bufnr()*
|
||||
bufnr([{expr} [, {create}]])
|
||||
The result is the number of a buffer, as it is displayed by
|
||||
the ":ls" command. For the use of {expr}, see |bufname()|
|
||||
the `:ls` command. For the use of {expr}, see |bufname()|
|
||||
above.
|
||||
|
||||
If the buffer doesn't exist, -1 is returned. Or, if the
|
||||
@@ -3677,10 +3679,10 @@ charidx({string}, {idx} [, {countcc}])
|
||||
The index of the first character is zero.
|
||||
If there are no multibyte characters the returned value is
|
||||
equal to {idx}.
|
||||
When {countcc} is omitted or zero, then composing characters
|
||||
are not counted separately, their byte length is added to the
|
||||
preceding base character.
|
||||
When {countcc} is set to 1, then composing characters are
|
||||
When {countcc} is omitted or |FALSE|, then composing characters
|
||||
are not counted separately, their byte length is
|
||||
added to the preceding base character.
|
||||
When {countcc} is |TRUE|, then composing characters are
|
||||
counted as separate characters.
|
||||
Returns -1 if the arguments are invalid or if {idx} is greater
|
||||
than the index of the last byte in {string}. An error is
|
||||
@@ -3852,7 +3854,9 @@ complete_info([{what}])
|
||||
See |complete-items|.
|
||||
selected Selected item index. First index is zero.
|
||||
Index is -1 if no item is selected (showing
|
||||
typed text only)
|
||||
typed text only, or the last completion after
|
||||
no item is selected when using the <Up> or
|
||||
<Down> keys)
|
||||
inserted Inserted string. [NOT IMPLEMENT YET]
|
||||
|
||||
*complete_info_mode*
|
||||
@@ -4067,6 +4071,7 @@ cursor({list})
|
||||
|setcursorcharpos()|.
|
||||
|
||||
Does not change the jumplist.
|
||||
{lnum} is used like with |getline()|.
|
||||
If {lnum} is greater than the number of lines in the buffer,
|
||||
the cursor will be positioned at the last line in the buffer.
|
||||
If {lnum} is zero, the cursor will stay in the current line.
|
||||
@@ -4437,6 +4442,8 @@ exepath({expr}) *exepath()*
|
||||
*exists()*
|
||||
exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined,
|
||||
zero otherwise.
|
||||
Note: In a compiled |:def| function local variables and
|
||||
arguments are not visible to `exists()`.
|
||||
|
||||
For checking for a supported feature use |has()|.
|
||||
For checking if a file exists use |filereadable()|.
|
||||
@@ -4459,9 +4466,11 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined,
|
||||
varname internal variable (see
|
||||
|internal-variables|). Also works
|
||||
for |curly-braces-names|, |Dictionary|
|
||||
entries, |List| items, etc. Beware
|
||||
that evaluating an index may cause an
|
||||
error message for an invalid
|
||||
entries, |List| items, etc.
|
||||
Does not work for local variables in a
|
||||
compiled `:def` function.
|
||||
Beware that evaluating an index may
|
||||
cause an error message for an invalid
|
||||
expression. E.g.: >
|
||||
:let l = [1, 2, 3]
|
||||
:echo exists("l[5]")
|
||||
@@ -4774,15 +4783,18 @@ filewritable({file}) *filewritable()*
|
||||
|
||||
|
||||
filter({expr1}, {expr2}) *filter()*
|
||||
{expr1} must be a |List| or a |Dictionary|.
|
||||
{expr1} must be a |List|, |Blob| or |Dictionary|.
|
||||
For each item in {expr1} evaluate {expr2} and when the result
|
||||
is zero remove the item from the |List| or |Dictionary|.
|
||||
is zero remove the item from the |List| or |Dictionary|. For a
|
||||
|Blob| each byte is removed.
|
||||
|
||||
{expr2} must be a |string| or |Funcref|.
|
||||
|
||||
If {expr2} is a |string|, inside {expr2} |v:val| has the value
|
||||
of the current item. For a |Dictionary| |v:key| has the key
|
||||
of the current item and for a |List| |v:key| has the index of
|
||||
the current item.
|
||||
the current item. For a |Blob| |v:key| has the index of the
|
||||
current byte.
|
||||
Examples: >
|
||||
call filter(mylist, 'v:val !~ "OLD"')
|
||||
< Removes the items where "OLD" appears. >
|
||||
@@ -4813,11 +4825,11 @@ filter({expr1}, {expr2}) *filter()*
|
||||
|Dictionary| to remain unmodified make a copy first: >
|
||||
:let l = filter(copy(mylist), 'v:val =~ "KEEP"')
|
||||
|
||||
< Returns {expr1}, the |List| or |Dictionary| that was filtered.
|
||||
When an error is encountered while evaluating {expr2} no
|
||||
further items in {expr1} are processed. When {expr2} is a
|
||||
Funcref errors inside a function are ignored, unless it was
|
||||
defined with the "abort" flag.
|
||||
< Returns {expr1}, the |List| , |Blob| or |Dictionary| that was
|
||||
filtered. When an error is encountered while evaluating
|
||||
{expr2} no further items in {expr1} are processed. When
|
||||
{expr2} is a Funcref errors inside a function are ignored,
|
||||
unless it was defined with the "abort" flag.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
mylist->filter(expr2)
|
||||
@@ -7138,9 +7150,9 @@ line2byte({lnum}) *line2byte()*
|
||||
below the last line: >
|
||||
line2byte(line("$") + 1)
|
||||
< This is the buffer size plus one. If 'fileencoding' is empty
|
||||
it is the file size plus one.
|
||||
When {lnum} is invalid, or the |+byte_offset| feature has been
|
||||
disabled at compile time, -1 is returned.
|
||||
it is the file size plus one. {lnum} is used like with
|
||||
|getline()|. When {lnum} is invalid, or the |+byte_offset|
|
||||
feature has been disabled at compile time, -1 is returned.
|
||||
Also see |byte2line()|, |go| and |:goto|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
@@ -7313,6 +7325,8 @@ luaeval({expr} [, {expr}]) *luaeval()*
|
||||
as-is.
|
||||
Other objects are returned as zero without any errors.
|
||||
See |lua-luaeval| for more details.
|
||||
Note that in a `:def` function local variables are not visible
|
||||
to {expr}.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetExpr()->luaeval()
|
||||
@@ -7332,7 +7346,8 @@ map({expr1}, {expr2}) *map()*
|
||||
If {expr2} is a |string|, inside {expr2} |v:val| has the value
|
||||
of the current item. For a |Dictionary| |v:key| has the key
|
||||
of the current item and for a |List| |v:key| has the index of
|
||||
the current item.
|
||||
the current item. For a |Blob| |v:key| has the index of the
|
||||
current byte.
|
||||
Example: >
|
||||
:call map(mylist, '"> " . v:val . " <"')
|
||||
< This puts "> " before and " <" after each item in "mylist".
|
||||
@@ -7978,6 +7993,10 @@ mode([expr]) Return a string that indicates the current mode.
|
||||
s Select by character
|
||||
S Select by line
|
||||
CTRL-S Select blockwise
|
||||
vs Visual by character using |v_CTRL-O| from
|
||||
Select mode
|
||||
Vs Visual by line using |v_CTRL-O| from Select mode
|
||||
CTRL-Vs Visual blockwise using |v_CTRL-O| from Select mode
|
||||
i Insert
|
||||
ic Insert mode completion |compl-generic|
|
||||
ix Insert mode |i_CTRL-X| completion
|
||||
@@ -8019,6 +8038,9 @@ mzeval({expr}) *mzeval()*
|
||||
:echo mzeval("l")
|
||||
:echo mzeval("h")
|
||||
<
|
||||
Note that in a `:def` function local variables are not visible
|
||||
to {expr}.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetExpr()->mzeval()
|
||||
<
|
||||
@@ -8030,6 +8052,7 @@ nextnonblank({lnum}) *nextnonblank()*
|
||||
if getline(nextnonblank(1)) =~ "Java"
|
||||
< When {lnum} is invalid or there is no non-blank line at or
|
||||
below it, zero is returned.
|
||||
{lnum} is used like with |getline()|.
|
||||
See also |prevnonblank()|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
@@ -8091,6 +8114,9 @@ perleval({expr}) *perleval()*
|
||||
:echo perleval('[1 .. 4]')
|
||||
< [1, 2, 3, 4]
|
||||
|
||||
Note that in a `:def` function local variables are not visible
|
||||
to {expr}.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetExpr()->perleval()
|
||||
|
||||
@@ -8122,6 +8148,7 @@ prevnonblank({lnum}) *prevnonblank()*
|
||||
let ind = indent(prevnonblank(v:lnum - 1))
|
||||
< When {lnum} is invalid or there is no non-blank line at or
|
||||
above it, zero is returned.
|
||||
{lnum} is used like with |getline()|.
|
||||
Also see |nextnonblank()|.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
@@ -8429,6 +8456,8 @@ py3eval({expr}) *py3eval()*
|
||||
Lists are represented as Vim |List| type.
|
||||
Dictionaries are represented as Vim |Dictionary| type with
|
||||
keys converted to strings.
|
||||
Note that in a `:def` function local variables are not visible
|
||||
to {expr}.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetExpr()->py3eval()
|
||||
@@ -8444,6 +8473,8 @@ pyeval({expr}) *pyeval()*
|
||||
Lists are represented as Vim |List| type.
|
||||
Dictionaries are represented as Vim |Dictionary| type,
|
||||
non-string keys result in error.
|
||||
Note that in a `:def` function local variables are not visible
|
||||
to {expr}.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetExpr()->pyeval()
|
||||
@@ -8703,7 +8734,8 @@ reltime([{start} [, {end}]]) *reltime()*
|
||||
and {end}.
|
||||
|
||||
The {start} and {end} arguments must be values returned by
|
||||
reltime().
|
||||
reltime(). If there is an error zero is returned in legacy
|
||||
script, in Vim9 script an error is given.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetStart()->reltime()
|
||||
@@ -8718,6 +8750,8 @@ reltimefloat({time}) *reltimefloat()*
|
||||
let seconds = reltimefloat(reltime(start))
|
||||
< See the note of reltimestr() about overhead.
|
||||
Also see |profiling|.
|
||||
If there is an error 0.0 is returned in legacy script, in Vim9
|
||||
script an error is given.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
reltime(start)->reltimefloat()
|
||||
@@ -8737,6 +8771,8 @@ reltimestr({time}) *reltimestr()*
|
||||
can use split() to remove it. >
|
||||
echo split(reltimestr(reltime(start)))[0]
|
||||
< Also see |profiling|.
|
||||
If there is an error an empty string is returned in legacy
|
||||
script, in Vim9 script an error is given.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
reltime(start)->reltimestr()
|
||||
@@ -8970,6 +9006,8 @@ rubyeval({expr}) *rubyeval()*
|
||||
Hashes are represented as Vim |Dictionary| type.
|
||||
Other objects are represented as strings resulted from their
|
||||
"Object#to_s" method.
|
||||
Note that in a `:def` function local variables are not visible
|
||||
to {expr}.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
GetRubyExpr()->rubyeval()
|
||||
@@ -10846,7 +10884,7 @@ synID({lnum}, {col}, {trans}) *synID()*
|
||||
line. 'synmaxcol' applies, in a longer line zero is returned.
|
||||
Note that when the position is after the last character,
|
||||
that's where the cursor can be in Insert mode, synID() returns
|
||||
zero.
|
||||
zero. {lnum} is used like with |getline()|.
|
||||
|
||||
When {trans} is |TRUE|, transparent items are reduced to the
|
||||
item that they reveal. This is useful when wanting to know
|
||||
@@ -10914,7 +10952,7 @@ synconcealed({lnum}, {col}) *synconcealed()*
|
||||
The result is a |List| with currently three items:
|
||||
1. The first item in the list is 0 if the character at the
|
||||
position {lnum} and {col} is not part of a concealable
|
||||
region, 1 if it is.
|
||||
region, 1 if it is. {lnum} is used like with |getline()|.
|
||||
2. The second item in the list is a string. If the first item
|
||||
is 1, the second item contains the text which will be
|
||||
displayed in place of the concealed text, depending on the
|
||||
@@ -10938,8 +10976,9 @@ synconcealed({lnum}, {col}) *synconcealed()*
|
||||
|
||||
synstack({lnum}, {col}) *synstack()*
|
||||
Return a |List|, which is the stack of syntax items at the
|
||||
position {lnum} and {col} in the current window. Each item in
|
||||
the List is an ID like what |synID()| returns.
|
||||
position {lnum} and {col} in the current window. {lnum} is
|
||||
used like with |getline()|. Each item in the List is an ID
|
||||
like what |synID()| returns.
|
||||
The first item in the List is the outer region, following are
|
||||
items contained in that one. The last one is what |synID()|
|
||||
returns, unless not the whole item is highlighted or it is a
|
||||
@@ -11666,7 +11705,7 @@ win_screenpos({nr}) *win_screenpos()*
|
||||
[1, 1], unless there is a tabline, then it is [2, 1].
|
||||
{nr} can be the window number or the |window-ID|. Use zero
|
||||
for the current window.
|
||||
Return [0, 0] if the window cannot be found in the current
|
||||
Returns [0, 0] if the window cannot be found in the current
|
||||
tabpage.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
@@ -14384,7 +14423,7 @@ displayed.
|
||||
|
||||
*except-several-errors*
|
||||
When several errors appear in a single command, the first error message is
|
||||
usually the most specific one and therefor converted to the error exception.
|
||||
usually the most specific one and therefore converted to the error exception.
|
||||
Example: >
|
||||
echo novar
|
||||
causes >
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*fold.txt* For Vim version 8.2. Last change: 2019 Jun 02
|
||||
*fold.txt* For Vim version 8.2. Last change: 2021 Jul 13
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -541,6 +541,8 @@ nest, the nested fold is one character right of the fold it's contained in.
|
||||
|
||||
A closed fold is indicated with a '+'.
|
||||
|
||||
These characters can be changed with the 'fillchars' option.
|
||||
|
||||
Where the fold column is too narrow to display all nested folds, digits are
|
||||
shown to indicate the nesting level.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*map.txt* For Vim version 8.2. Last change: 2021 May 16
|
||||
*map.txt* For Vim version 8.2. Last change: 2021 Jul 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1580,7 +1580,8 @@ Example: >
|
||||
echo 'hello'
|
||||
g:calledMyCommand = true
|
||||
}
|
||||
No nesting is supported.
|
||||
No nesting is supported. Using `:normal` directly does not work, you can use
|
||||
it indirectly with `:execute`.
|
||||
|
||||
The replacement text {repl} for a user defined command is scanned for special
|
||||
escape sequences, using <...> notation. Escape sequences are replaced with
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 8.2. Last change: 2021 Jun 20
|
||||
*options.txt* For Vim version 8.2. Last change: 2021 Jul 22
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -8669,6 +8669,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
The `g$` command will move to the end of the screen line.
|
||||
It doesn't make sense to combine "all" with "onemore", but you will
|
||||
not get a warning for it.
|
||||
When combined with other words, "none" is ignored.
|
||||
NOTE: This option is set to "" when 'compatible' is set.
|
||||
|
||||
*'visualbell'* *'vb'* *'novisualbell'* *'novb'* *beep*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*pattern.txt* For Vim version 8.2. Last change: 2021 May 02
|
||||
*pattern.txt* For Vim version 8.2. Last change: 2021 Jul 16
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -936,7 +936,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|
||||
can be any line number. The first line is 1.
|
||||
WARNING: When inserting or deleting lines Vim does not automatically
|
||||
update the matches. This means Syntax highlighting quickly becomes
|
||||
wrong. Also when refering to the cursor position (".") and
|
||||
wrong. Also when referring to the cursor position (".") and
|
||||
the cursor moves the display isn't updated for this change. An update
|
||||
is done when using the |CTRL-L| command (the whole screen is updated).
|
||||
Example, to highlight the line where the cursor currently is: >
|
||||
@@ -959,7 +959,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|
||||
for multibyte characters).
|
||||
WARNING: When inserting or deleting text Vim does not automatically
|
||||
update the matches. This means Syntax highlighting quickly becomes
|
||||
wrong. Also when refering to the cursor position (".") and
|
||||
wrong. Also when referring to the cursor position (".") and
|
||||
the cursor moves the display isn't updated for this change. An update
|
||||
is done when using the |CTRL-L| command (the whole screen is updated).
|
||||
|
||||
@@ -989,7 +989,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on):
|
||||
one screen character.
|
||||
WARNING: When inserting or deleting text Vim does not automatically
|
||||
update highlighted matches. This means Syntax highlighting quickly
|
||||
becomes wrong. Also when refering to the cursor position (".") and
|
||||
becomes wrong. Also when referring to the cursor position (".") and
|
||||
the cursor moves the display isn't updated for this change. An update
|
||||
is done when using the |CTRL-L| command (the whole screen is updated).
|
||||
Example, to highlight all the characters after virtual column 72: >
|
||||
@@ -1472,7 +1472,8 @@ criteria:
|
||||
- The number of characters (distance) between two consecutive matching
|
||||
characters.
|
||||
- Matches at the beginning of a word
|
||||
- Matches after a camel case character or a path separator or a hyphen.
|
||||
- Matches at a camel case character (e.g. Case in CamelCase)
|
||||
- Matches after a path separator or a hyphen.
|
||||
- The number of unmatched characters in a string.
|
||||
The matching string with the highest score is returned first.
|
||||
|
||||
|
||||
@@ -923,7 +923,7 @@ For Visual Basic use: >
|
||||
|
||||
BAAN *baan.vim* *baan-syntax*
|
||||
|
||||
The baan.vim gives syntax support for BaanC of release BaanIV upto SSA ERP LN
|
||||
The baan.vim gives syntax support for BaanC of release BaanIV up to SSA ERP LN
|
||||
for both 3 GL and 4 GL programming. Large number of standard defines/constants
|
||||
are supported.
|
||||
|
||||
|
||||
@@ -3978,7 +3978,9 @@ E12 message.txt /*E12*
|
||||
E120 eval.txt /*E120*
|
||||
E1200 options.txt /*E1200*
|
||||
E1201 options.txt /*E1201*
|
||||
E1205 eval.txt /*E1205*
|
||||
E121 eval.txt /*E121*
|
||||
E1214 eval.txt /*E1214*
|
||||
E122 eval.txt /*E122*
|
||||
E123 eval.txt /*E123*
|
||||
E124 eval.txt /*E124*
|
||||
@@ -6161,6 +6163,10 @@ digraph-encoding digraph.txt /*digraph-encoding*
|
||||
digraph-table digraph.txt /*digraph-table*
|
||||
digraph-table-mbyte digraph.txt /*digraph-table-mbyte*
|
||||
digraph.txt digraph.txt /*digraph.txt*
|
||||
digraph_get() eval.txt /*digraph_get()*
|
||||
digraph_getlist() eval.txt /*digraph_getlist()*
|
||||
digraph_set() eval.txt /*digraph_set()*
|
||||
digraph_setlist() eval.txt /*digraph_setlist()*
|
||||
digraphs digraph.txt /*digraphs*
|
||||
digraphs-changed version6.txt /*digraphs-changed*
|
||||
digraphs-default digraph.txt /*digraphs-default*
|
||||
@@ -10160,6 +10166,7 @@ vim-8.2 version8.txt /*vim-8.2*
|
||||
vim-additions vi_diff.txt /*vim-additions*
|
||||
vim-announce intro.txt /*vim-announce*
|
||||
vim-arguments starting.txt /*vim-arguments*
|
||||
vim-changelog version8.txt /*vim-changelog*
|
||||
vim-default-editor gui_w32.txt /*vim-default-editor*
|
||||
vim-dev intro.txt /*vim-dev*
|
||||
vim-mac intro.txt /*vim-mac*
|
||||
@@ -10305,6 +10312,7 @@ win32-faq os_win32.txt /*win32-faq*
|
||||
win32-gettext mlang.txt /*win32-gettext*
|
||||
win32-gui gui_w32.txt /*win32-gui*
|
||||
win32-hidden-menus gui.txt /*win32-hidden-menus*
|
||||
win32-installer os_win32.txt /*win32-installer*
|
||||
win32-mouse os_win32.txt /*win32-mouse*
|
||||
win32-open-with-menu gui_w32.txt /*win32-open-with-menu*
|
||||
win32-popup-menu gui_w32.txt /*win32-popup-menu*
|
||||
|
||||
@@ -211,6 +211,8 @@ prop_list({lnum} [, {props}]) *prop_list()*
|
||||
id property ID
|
||||
type name of the property type, omitted if
|
||||
the type was deleted
|
||||
type_bufnr buffer number for which this type was defined;
|
||||
0 if the type is global
|
||||
start when TRUE property starts in this line
|
||||
end when TRUE property ends in this line
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 8.2. Last change: 2021 Jul 05
|
||||
*todo.txt* For Vim version 8.2. Last change: 2021 Jul 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -38,11 +38,14 @@ browser use: https://github.com/vim/vim/issues/1234
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
Try out callgrind with kcachegrind.
|
||||
|
||||
Vim9 - Make everything work:
|
||||
- possible leak in test_vim9_builtin ?
|
||||
- Make "for _ in range()" work, do not store the value in a var.
|
||||
- Check TODO items in vim9compile.c and vim9execute.c
|
||||
- use CheckLegacyAndVim9Success(lines) in many more places
|
||||
- compile get_lambda_tv() in popup_add_timeout()
|
||||
This doesn't work - Test_list_assign():
|
||||
var l = [0]
|
||||
l[:] = [1, 2]
|
||||
- For builtin functions using tv_get_string*() use check_for_string() to be
|
||||
more strict about the argument type (not a bool).
|
||||
done: balloon_()
|
||||
@@ -214,10 +217,13 @@ Terminal emulator window:
|
||||
|
||||
Include patch #6290: recognize shell directory change.
|
||||
|
||||
MS-Windows GUI: default 'encoding' to "utf-8" ? (#8221)
|
||||
Add #ifdef MSWIN before enc_locale() in set_init_1().
|
||||
Or just always for MS-Windows? Conversion to 'termencoding' should always
|
||||
work?
|
||||
When using 'cryptmethod' xchaha20 the undo file is not encrypted.
|
||||
Need to handle extra bytes.
|
||||
|
||||
Test_communicate_ipv6(): is flaky on many systems
|
||||
Fails in line 64 of Ch_communicate, no exception is thrown.
|
||||
|
||||
Rename getdigraphlist -> digraph_getlist() etc.
|
||||
|
||||
Valgrind reports memory leaks in test_options.
|
||||
Valgrind reports overlapping memcpy in
|
||||
@@ -242,6 +248,8 @@ Memory leaks in test_channel? (or is it because of fork())
|
||||
initialization to figure out the default value from 'shell'. Add a test for
|
||||
this.
|
||||
|
||||
MS-Windows: did path modifier :p:8 stop working? #8600
|
||||
|
||||
test_arglist func Test_all_not_allowed_from_cmdwin() hangs on MS-Windows.
|
||||
|
||||
Mapping with partial match not executed properly in GTK. (Ingo Karkat, #7082)
|
||||
@@ -269,6 +277,9 @@ Remove SPACE_IN_FILENAME ? It is only used for completion.
|
||||
Searching for \%'> does not find anything when using line Visual selection.
|
||||
Probably because it's using MAXCOL. #8238
|
||||
|
||||
Make "g>" and "g<" in Visual mode move the text right or left.
|
||||
Also for a block selection. #8558
|
||||
|
||||
Add optional argument to virtcol() that specifies "start", "cursor" or "end"
|
||||
to tell which value from getvvcol() should be used. (#7964)
|
||||
Value returned by virtcol() changes depending on how lines wrap. This is
|
||||
@@ -280,10 +291,12 @@ Scroll doesn't work correctly, why?
|
||||
glob() and globfile() do not always honor 'wildignorecase'. #8350
|
||||
globpath() does not use 'wildignorecase' at all?
|
||||
|
||||
":find" incorrectly searches parent directory of path (#8533)
|
||||
|
||||
Add 'termguiattr' option, use "gui=" attributes in the terminal? Would work
|
||||
with 'termguicolors'. #1740
|
||||
|
||||
Patch for blockwise paste reporting changes: #6660.
|
||||
Patch for blockwise paste reporting changes: #6660. Asked for a PR.
|
||||
|
||||
Patch to make fillchars global-local. (#5206)
|
||||
|
||||
@@ -3069,7 +3082,7 @@ Awaiting updated patches:
|
||||
7 When 'rightleft' is set, the search pattern should be displayed right
|
||||
to left as well? See patch of Dec 26. (Nadim Shaikli)
|
||||
8 Option to lock all used memory so that it doesn't get swapped to disk
|
||||
(uncrypted). Patch by Jason Holt, 2003 May 23. Uses mlock.
|
||||
(unencrypted). Patch by Jason Holt, 2003 May 23. Uses mlock.
|
||||
7 Add ! register, for shell commands. (patch from Grenie)
|
||||
8 In the gzip plugin, also recognize *.gz.orig, *.gz.bak, etc. Like it's
|
||||
done for filetype detection. Patch from Walter Briscoe, 2003 Jul 1.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 8.2. Last change: 2021 Jun 07
|
||||
*usr_41.txt* For Vim version 8.2. Last change: 2021 Jul 19
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
|
||||
@@ -5465,7 +5465,7 @@ Files: src/fileio.c
|
||||
Patch 6.0.267
|
||||
Problem: UTF-8: Although 'isprint' says a character is printable,
|
||||
utf_char2cells() still considers it unprintable.
|
||||
Solution: Use vim_isprintc() for characters upto 0x100. (Yasuhiro Matsumoto)
|
||||
Solution: Use vim_isprintc() for characters up to 0x100. (Yasuhiro Matsumoto)
|
||||
Files: src/mbyte.c
|
||||
|
||||
Patch 6.0.268 (extra) (depends on patch 6.0.255)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*version7.txt* For Vim version 8.2. Last change: 2021 May 13
|
||||
*version7.txt* For Vim version 8.2. Last change: 2021 May 17
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -16225,7 +16225,7 @@ Files: src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok,
|
||||
Patch 7.3.1018
|
||||
Problem: New regexp engine wastes memory.
|
||||
Solution: Allocate prog with actual number of states, not estimated maximum
|
||||
number of sates.
|
||||
number of states.
|
||||
Files: src/regexp_nfa.c
|
||||
|
||||
Patch 7.3.1019
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*version8.txt* For Vim version 8.2. Last change: 2021 May 13
|
||||
*version8.txt* For Vim version 8.2. Last change: 2021 Jul 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -41,6 +41,10 @@ See |vi_diff.txt| for an overview of differences between Vi and Vim 8.0.
|
||||
See |version4.txt|, |version5.txt|, |version6.txt| and |version7.txt| for
|
||||
differences between other versions.
|
||||
|
||||
*vim-changelog*
|
||||
You can find an overview of the most important changes (according to Martin
|
||||
Tournoij) on this site: https://www.arp242.net/vimlog/
|
||||
|
||||
==============================================================================
|
||||
NEW FEATURES *new-8*
|
||||
|
||||
@@ -12980,7 +12984,7 @@ Files: src/evalfunc.c, src/testdir/test_cmdline.vim
|
||||
Patch 7.4.2113
|
||||
Problem: Test for undo is flaky.
|
||||
Solution: Turn it into a new style test. Use test_settime() to avoid
|
||||
flakyness.
|
||||
flakiness.
|
||||
Files: src/Makefile, src/undo.c, src/testdir/test61.in,
|
||||
src/testdir/test61.ok, src/testdir/test_undo.vim,
|
||||
src/testdir/test_undolevels.vim, src/testdir/Make_all.mak,
|
||||
@@ -30906,7 +30910,7 @@ Files: src/eval.c, src/testdir/test_assert.vim
|
||||
Patch 8.1.0820
|
||||
Problem: Test for sending large data over channel sometimes fails.
|
||||
Solution: Handle that the job may have finished early. Also fix that file
|
||||
changed test doesn't work in the GUI and reduce flakyness. (Ozaki
|
||||
changed test doesn't work in the GUI and reduce flakiness. (Ozaki
|
||||
Kiichi, closes #3861)
|
||||
Files: src/testdir/test_channel.vim, src/testdir/test_filechanged.vim
|
||||
|
||||
@@ -39253,7 +39257,7 @@ Files: src/option.c
|
||||
|
||||
Patch 8.1.2117
|
||||
Problem: CursorLine highlight used while 'cursorline' is off.
|
||||
Solution: Check 'cursorline' is set. (cloes #5017)
|
||||
Solution: Check 'cursorline' is set. (closes #5017)
|
||||
Files: src/drawline.c, src/testdir/test_cursorline.vim
|
||||
|
||||
Patch 8.1.2118
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2021 Jul 07
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2021 Jul 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -321,6 +321,25 @@ used: >
|
||||
}
|
||||
echo temp # Error!
|
||||
|
||||
This is especially useful in a user command: >
|
||||
|
||||
command -range Rename {
|
||||
| var save = @a
|
||||
| @a = 'some expression'
|
||||
| echo 'do something with ' .. @a
|
||||
| @a = save
|
||||
|}
|
||||
|
||||
And with autocommands: >
|
||||
|
||||
au BufWritePre *.go {
|
||||
| var save = winsaveview()
|
||||
| silent! exe ':%! some formatting command'
|
||||
| winrestview(save)
|
||||
|}
|
||||
|
||||
Although using a :def function probably works better.
|
||||
|
||||
Declaring a variable with a type but without an initializer will initialize to
|
||||
zero, false or empty.
|
||||
|
||||
@@ -332,6 +351,9 @@ with `:unlet`.
|
||||
`:lockvar` does not work on local variables. Use `:const` and `:final`
|
||||
instead.
|
||||
|
||||
The `exists()` function does not work on local variables or arguments. These
|
||||
are visible at compile time only, not at runtime.
|
||||
|
||||
Variables, functions and function arguments cannot shadow previously defined
|
||||
or imported variables and functions in the same script file.
|
||||
Variables may shadow Ex commands, rename the variable if needed.
|
||||
@@ -426,6 +448,12 @@ line starts with `substitute(` this will use the function. Prepend a colon to
|
||||
use the command instead: >
|
||||
:substitute(pattern (replacement (
|
||||
|
||||
If the expression starts with "!" this is interpreted as a shell command, not
|
||||
negation of a condition. Thus this is a shell command: >
|
||||
!shellCommand->something
|
||||
Put the expression in parenthesis to use the "!" for negation: >
|
||||
(!expression)->Method()
|
||||
|
||||
Note that while variables need to be defined before they can be used,
|
||||
functions can be called before being defined. This is required to allow
|
||||
for cyclic dependencies between functions. It is slightly less efficient,
|
||||
@@ -687,6 +715,9 @@ White space is not allowed:
|
||||
arg # OK
|
||||
)
|
||||
|
||||
White space space is not allowed in a `:set` command between the option name
|
||||
and a following "&", "!", "<", "=", "+=", "-=" or "^=".
|
||||
|
||||
|
||||
No curly braces expansion ~
|
||||
|
||||
@@ -1045,26 +1076,36 @@ For these the backtick expansion can be used. Example: >
|
||||
g/pattern/s/^/`=newText`/
|
||||
enddef
|
||||
|
||||
Or a script variable can be used: >
|
||||
var newText = 'blah'
|
||||
def Replace()
|
||||
g/pattern/s/^/\=newText/
|
||||
enddef
|
||||
|
||||
Closures defined in a loop will share the same context. For example: >
|
||||
var flist: list<func>
|
||||
for i in range(10)
|
||||
for i in range(5)
|
||||
var inloop = i
|
||||
flist[i] = () => inloop
|
||||
endfor
|
||||
echo range(5)->map((i, _) => flist[i]())
|
||||
# Result: [4, 4, 4, 4, 4]
|
||||
|
||||
The "inloop" variable will exist only once, all closures put in the list refer
|
||||
to the same instance, which in the end will have the value 9. This is
|
||||
efficient. If you do want a separate context for each closure call a function
|
||||
to define it: >
|
||||
def GetFunc(i: number): func
|
||||
var inloop = i
|
||||
return () => inloop
|
||||
to the same instance, which in the end will have the value 4. This is
|
||||
efficient, also when looping many times. If you do want a separate context
|
||||
for each closure call a function to define it: >
|
||||
def GetClosure(i: number): func
|
||||
var infunc = i
|
||||
return () => infunc
|
||||
enddef
|
||||
|
||||
var flist: list<func>
|
||||
for i in range(10)
|
||||
flist[i] = GetFunc(i)
|
||||
for i in range(5)
|
||||
flist[i] = GetClosure(i)
|
||||
endfor
|
||||
echo range(5)->map((i, _) => flist[i]())
|
||||
# Result: [0, 1, 2, 3, 4]
|
||||
|
||||
==============================================================================
|
||||
|
||||
@@ -1366,7 +1407,8 @@ The script name after `import` can be:
|
||||
- A path not being relative or absolute. This will be found in the
|
||||
"import" subdirectories of 'runtimepath' entries. The name will usually be
|
||||
longer and unique, to avoid loading the wrong file.
|
||||
Note that "after/import" is not used.
|
||||
Note that "after/import" is not used, unless it is explicitly added in
|
||||
'runtimepath'.
|
||||
|
||||
Once a vim9 script file has been imported, the result is cached and used the
|
||||
next time the same script is imported. It will not be read again.
|
||||
@@ -1457,7 +1499,7 @@ Some examples: >
|
||||
var name: string
|
||||
|
||||
def constructor(name: string)
|
||||
this.name = name;
|
||||
this.name = name
|
||||
enddef
|
||||
|
||||
def display(): void
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim indent file
|
||||
" Language: Bazel (http://bazel.io)
|
||||
" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl)
|
||||
" Last Change: 2017 Jun 13
|
||||
" Last Change: 2021 Jul 08
|
||||
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
@@ -41,30 +41,41 @@ function GetBzlIndent(lnum) abort
|
||||
if exists('g:pyindent_open_paren')
|
||||
let l:pyindent_open_paren = g:pyindent_open_paren
|
||||
endif
|
||||
let g:pyindent_nested_paren = 'shiftwidth() * 2'
|
||||
let g:pyindent_open_paren = 'shiftwidth() * 2'
|
||||
let g:pyindent_nested_paren = 'shiftwidth()'
|
||||
let g:pyindent_open_paren = 'shiftwidth()'
|
||||
endif
|
||||
|
||||
let l:indent = -1
|
||||
|
||||
" Indent inside parens.
|
||||
" Align with the open paren unless it is at the end of the line.
|
||||
" E.g.
|
||||
" open_paren_not_at_EOL(100,
|
||||
" (200,
|
||||
" 300),
|
||||
" 400)
|
||||
" open_paren_at_EOL(
|
||||
" 100, 200, 300, 400)
|
||||
call cursor(a:lnum, 1)
|
||||
let [l:par_line, l:par_col] = searchpairpos('(\|{\|\[', '', ')\|}\|\]', 'bW',
|
||||
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" .
|
||||
\ " synIDattr(synID(line('.'), col('.'), 1), 'name')" .
|
||||
\ " =~ '\\(Comment\\|String\\)$'")
|
||||
if l:par_line > 0
|
||||
call cursor(l:par_line, 1)
|
||||
if l:par_col != col('$') - 1
|
||||
let l:indent = l:par_col
|
||||
" Indent inside parens.
|
||||
if searchpair('(\|{\|\[', '', ')\|}\|\]', 'W',
|
||||
\ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" .
|
||||
\ " synIDattr(synID(line('.'), col('.'), 1), 'name')" .
|
||||
\ " =~ '\\(Comment\\|String\\)$'") && line('.') == a:lnum
|
||||
" If cursor is at close parens, match indent with open parens.
|
||||
" E.g.
|
||||
" foo(
|
||||
" )
|
||||
let l:indent = indent(l:par_line)
|
||||
else
|
||||
" Align with the open paren unless it is at the end of the line.
|
||||
" E.g.
|
||||
" open_paren_not_at_EOL(100,
|
||||
" (200,
|
||||
" 300),
|
||||
" 400)
|
||||
" open_paren_at_EOL(
|
||||
" 100, 200, 300, 400)
|
||||
call cursor(l:par_line, 1)
|
||||
if l:par_col != col('$') - 1
|
||||
let l:indent = l:par_col
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ text comment
|
||||
</tag1>
|
||||
<!--
|
||||
text comment
|
||||
end coment -->
|
||||
end comment -->
|
||||
</tag0>
|
||||
<!-- END_INDENT -->
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</tag1>
|
||||
<!--
|
||||
text comment
|
||||
end coment -->
|
||||
end comment -->
|
||||
</tag0>
|
||||
<!-- END_INDENT -->
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ map F "hy2l
|
||||
map C "fp
|
||||
map e "fy2l
|
||||
map E "hp
|
||||
map F "hy2l
|
||||
map F "hy2l
|
||||
|
||||
" initialisations:
|
||||
" KM cleanup buffer
|
||||
|
||||
@@ -4,7 +4,7 @@ For instructions on installing this file, type
|
||||
`:help matchit-install`
|
||||
inside Vim.
|
||||
|
||||
For Vim version 8.1. Last change: 2020 Mar 01
|
||||
For Vim version 8.1. Last change: 2021 May 17
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Benji Fisher et al
|
||||
@@ -320,7 +320,7 @@ should work (and have the same effect as "foobar:barfoo:endfoobar"), although
|
||||
this has not been thoroughly tested.
|
||||
|
||||
You can use |zero-width| patterns such as |\@<=| and |\zs|. (The latter has
|
||||
not been thouroughly tested in matchit.vim.) For example, if the keyword "if"
|
||||
not been thoroughly tested in matchit.vim.) For example, if the keyword "if"
|
||||
must occur at the start of the line, with optional white space, you might use
|
||||
the pattern "\(^\s*\)\@<=if" so that the cursor will end on the "i" instead of
|
||||
at the start of the line. For another example, if HTML had only one tag then
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
SPELLDIR = ..
|
||||
FILES = tet_ID.aff tet_ID.dic
|
||||
|
||||
# I don't hava a Tetum locale, use the Dutch one instead.
|
||||
# I don't have a Tetum locale, use the Dutch one instead.
|
||||
all: $SPELLDIR/tet.latin1.spl $SPELLDIR/tet.utf-8.spl ../README_tet.txt
|
||||
|
||||
$SPELLDIR/tet.latin1.spl : $FILES
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: APT config file
|
||||
" Maintainer: Yann Amar <quidame@poivron.org>
|
||||
" Last Change: 2015 Dec 22
|
||||
" Last Change: 2021 Jul 12
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if !exists("main_syntax")
|
||||
@@ -396,10 +396,13 @@ syn cluster aptconfSynaptic_ contains=aptconfSynaptic,
|
||||
" }}}
|
||||
" Unattended Upgrade: {{{
|
||||
syn keyword aptconfUnattendedUpgrade contained
|
||||
\ AutoFixInterruptedDpkg Automatic-Reboot Automatic-Reboot-Time
|
||||
\ Automatic-Reboot-WithUsers InstallOnShutdown Mail MailOnlyOnError
|
||||
\ MinimalSteps Origins-Pattern Package-Blacklist
|
||||
\ Remove-Unused-Dependencies
|
||||
\ Allow-APT-Mark-Fallback Allow-downgrade AutoFixInterruptedDpkg
|
||||
\ Automatic-Reboot Automatic-Reboot-Time Automatic-Reboot-WithUsers
|
||||
\ Debug InstallOnShutdown Mail MailOnlyOnError MailReport MinimalSteps
|
||||
\ OnlyOnACPower Origins-Pattern Package-Blacklist
|
||||
\ Remove-New-Unused-Dependencies Remove-Unused-Dependencies
|
||||
\ Remove-Unused-Kernel-Packages Skip-Updates-On-Metered-Connections
|
||||
\ SyslogEnable SyslogFacility Verbose
|
||||
|
||||
syn cluster aptconfUnattendedUpgrade_ contains=aptconfUnattendedUpgrade
|
||||
" }}}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Previous Maintainers: Xavier Crégut <xavier.cregut@enseeiht.fr>
|
||||
" Mario Eusebio <bio@dq.fct.unl.pt>
|
||||
" Last Change: 2021 Apr 23
|
||||
" Last Change: 2021 May 20
|
||||
|
||||
" Contributors: Tim Chase <tchase@csc.com>,
|
||||
" Stas Grabois <stsi@vtrails.com>,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: ReDIF
|
||||
" Maintainer: Axel Castellane <axel.castellane@polytechnique.edu>
|
||||
" Last Change: 2021 Jun 17
|
||||
" Last Change: 2013 April 17
|
||||
" Original Author: Axel Castellane
|
||||
" Source: http://openlib.org/acmes/root/docu/redif_1.html
|
||||
" File Extension: rdf
|
||||
@@ -932,7 +932,7 @@ highlight redifFieldDeprecated term=undercurl cterm=undercurl gui=undercurl guis
|
||||
" Sync: The template-type (ReDIF-Paper, ReDIF-Archive, etc.) influences which
|
||||
" fields can follow. Thus sync must search backwards for it.
|
||||
"
|
||||
" I would like to simply ask VIM to search backward for the first occurrence of
|
||||
" I would like to simply ask VIM to search backward for the first occurence of
|
||||
" /^Template-Type:/, but it does not seem to be possible, so I have to start
|
||||
" from the beginning of the file... This might slow down a lot for files that
|
||||
" contain a lot of Template-Type statements.
|
||||
|
||||
@@ -19,7 +19,7 @@ Name of tags file to create. (default is 'tags')
|
||||
.IP "\fB-s <shell>\fP"
|
||||
The name of the shell used by the script(s). By default,
|
||||
\fBshtags\fP tries to work out which is the appropriate shell for each
|
||||
file individually by looking at the first line of each file. This wont
|
||||
file individually by looking at the first line of each file. This won't
|
||||
work however, if the script starts as a bourne shell script and tries
|
||||
to be clever about starting the shell it really wants.
|
||||
.b
|
||||
|
||||
@@ -509,7 +509,7 @@ SendEventProc(
|
||||
/*
|
||||
* Didn't recognize this thing. Just skip through the next
|
||||
* null character and try again.
|
||||
* Also, throw away commands that we cant process anyway.
|
||||
* Also, throw away commands that we can't process anyway.
|
||||
*/
|
||||
|
||||
while (*p != 0)
|
||||
|
||||
@@ -35,6 +35,15 @@ UINT cbFiles = 0;
|
||||
* enough */
|
||||
#define BUFSIZE 1100
|
||||
|
||||
// The "Edit with Vim" shell extension provides these choices when
|
||||
// a new instance of Gvim is selected:
|
||||
// - use tabpages
|
||||
// - enable diff mode
|
||||
// - none of the above
|
||||
#define EDIT_WITH_VIM_USE_TABPAGES (2)
|
||||
#define EDIT_WITH_VIM_IN_DIFF_MODE (1)
|
||||
#define EDIT_WITH_VIM_NO_OPTIONS (0)
|
||||
|
||||
//
|
||||
// Get the name of the Gvim executable to use, with the path.
|
||||
// When "runtime" is non-zero, we were called to find the runtime directory.
|
||||
@@ -613,7 +622,7 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu,
|
||||
if (cbFiles > 1)
|
||||
{
|
||||
mii.wID = idCmd++;
|
||||
mii.dwTypeData = _("Edit with &multiple Vims");
|
||||
mii.dwTypeData = _("Edit with Vim using &tabpages");
|
||||
mii.cch = lstrlen(mii.dwTypeData);
|
||||
InsertMenuItem(hMenu, indexMenu++, TRUE, &mii);
|
||||
|
||||
@@ -726,6 +735,7 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu,
|
||||
STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
|
||||
{
|
||||
HRESULT hr = E_INVALIDARG;
|
||||
int gvimExtraOptions;
|
||||
|
||||
// If HIWORD(lpcmi->lpVerb) then we have been called programmatically
|
||||
// and lpVerb is a command that should be invoked. Otherwise, the shell
|
||||
@@ -750,29 +760,28 @@ STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
|
||||
switch (idCmd)
|
||||
{
|
||||
case 0:
|
||||
hr = InvokeGvim(lpcmi->hwnd,
|
||||
lpcmi->lpDirectory,
|
||||
lpcmi->lpVerb,
|
||||
lpcmi->lpParameters,
|
||||
lpcmi->nShow);
|
||||
gvimExtraOptions = EDIT_WITH_VIM_USE_TABPAGES;
|
||||
break;
|
||||
case 1:
|
||||
hr = InvokeSingleGvim(lpcmi->hwnd,
|
||||
lpcmi->lpDirectory,
|
||||
lpcmi->lpVerb,
|
||||
lpcmi->lpParameters,
|
||||
lpcmi->nShow,
|
||||
0);
|
||||
gvimExtraOptions = EDIT_WITH_VIM_NO_OPTIONS;
|
||||
break;
|
||||
case 2:
|
||||
hr = InvokeSingleGvim(lpcmi->hwnd,
|
||||
lpcmi->lpDirectory,
|
||||
lpcmi->lpVerb,
|
||||
lpcmi->lpParameters,
|
||||
lpcmi->nShow,
|
||||
1);
|
||||
gvimExtraOptions = EDIT_WITH_VIM_IN_DIFF_MODE;
|
||||
break;
|
||||
default:
|
||||
// If execution reaches this point we likely have an
|
||||
// inconsistency between the code that setup the menus
|
||||
// and this code that determines what the user
|
||||
// selected. This should be detected and fixed during
|
||||
// development.
|
||||
return E_FAIL;
|
||||
}
|
||||
hr = InvokeSingleGvim(lpcmi->hwnd,
|
||||
lpcmi->lpDirectory,
|
||||
lpcmi->lpVerb,
|
||||
lpcmi->lpParameters,
|
||||
lpcmi->nShow,
|
||||
gvimExtraOptions);
|
||||
}
|
||||
}
|
||||
return hr;
|
||||
@@ -873,82 +882,13 @@ searchpath(char *name)
|
||||
return (char *)"";
|
||||
}
|
||||
|
||||
STDMETHODIMP CShellExt::InvokeGvim(HWND hParent,
|
||||
LPCSTR /* pszWorkingDir */,
|
||||
LPCSTR /* pszCmd */,
|
||||
LPCSTR /* pszParam */,
|
||||
int /* iShowCmd */)
|
||||
{
|
||||
wchar_t m_szFileUserClickedOn[BUFSIZE];
|
||||
wchar_t cmdStrW[BUFSIZE];
|
||||
UINT i;
|
||||
|
||||
for (i = 0; i < cbFiles; i++)
|
||||
{
|
||||
DragQueryFileW((HDROP)medium.hGlobal,
|
||||
i,
|
||||
m_szFileUserClickedOn,
|
||||
sizeof(m_szFileUserClickedOn));
|
||||
|
||||
getGvimInvocationW(cmdStrW);
|
||||
wcscat(cmdStrW, L" \"");
|
||||
|
||||
if ((wcslen(cmdStrW) + wcslen(m_szFileUserClickedOn) + 2) < BUFSIZE)
|
||||
{
|
||||
wcscat(cmdStrW, m_szFileUserClickedOn);
|
||||
wcscat(cmdStrW, L"\"");
|
||||
|
||||
STARTUPINFOW si;
|
||||
PROCESS_INFORMATION pi;
|
||||
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
|
||||
// Start the child process.
|
||||
if (!CreateProcessW(NULL, // No module name (use command line).
|
||||
cmdStrW, // Command line.
|
||||
NULL, // Process handle not inheritable.
|
||||
NULL, // Thread handle not inheritable.
|
||||
FALSE, // Set handle inheritance to FALSE.
|
||||
0, // No creation flags.
|
||||
NULL, // Use parent's environment block.
|
||||
NULL, // Use parent's starting directory.
|
||||
&si, // Pointer to STARTUPINFO structure.
|
||||
&pi) // Pointer to PROCESS_INFORMATION structure.
|
||||
)
|
||||
{
|
||||
MessageBox(
|
||||
hParent,
|
||||
_("Error creating process: Check if gvim is in your path!"),
|
||||
_("gvimext.dll error"),
|
||||
MB_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
CloseHandle( pi.hProcess );
|
||||
CloseHandle( pi.hThread );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox(
|
||||
hParent,
|
||||
_("Path length too long!"),
|
||||
_("gvimext.dll error"),
|
||||
MB_OK);
|
||||
}
|
||||
}
|
||||
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
|
||||
LPCSTR /* pszWorkingDir */,
|
||||
LPCSTR /* pszCmd */,
|
||||
LPCSTR /* pszParam */,
|
||||
int /* iShowCmd */,
|
||||
int useDiff)
|
||||
int gvimExtraOptions)
|
||||
{
|
||||
wchar_t m_szFileUserClickedOn[BUFSIZE];
|
||||
wchar_t *cmdStrW;
|
||||
@@ -962,8 +902,10 @@ STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
|
||||
return E_FAIL;
|
||||
getGvimInvocationW(cmdStrW);
|
||||
|
||||
if (useDiff)
|
||||
if (gvimExtraOptions == EDIT_WITH_VIM_IN_DIFF_MODE)
|
||||
wcscat(cmdStrW, L" -d");
|
||||
else if (gvimExtraOptions == EDIT_WITH_VIM_USE_TABPAGES)
|
||||
wcscat(cmdStrW, L" -p");
|
||||
for (i = 0; i < cbFiles; i++)
|
||||
{
|
||||
DragQueryFileW((HDROP)medium.hGlobal,
|
||||
|
||||
@@ -129,18 +129,12 @@ protected:
|
||||
int iShowCmd,
|
||||
int idHWnd);
|
||||
|
||||
STDMETHODIMP InvokeGvim(HWND hParent,
|
||||
LPCSTR pszWorkingDir,
|
||||
LPCSTR pszCmd,
|
||||
LPCSTR pszParam,
|
||||
int iShowCmd);
|
||||
|
||||
STDMETHODIMP InvokeSingleGvim(HWND hParent,
|
||||
LPCSTR pszWorkingDir,
|
||||
LPCSTR pszCmd,
|
||||
LPCSTR pszParam,
|
||||
int iShowCmd,
|
||||
int useDiff);
|
||||
int gvimExtraOptions);
|
||||
|
||||
public:
|
||||
int m_cntOfHWnd;
|
||||
|
||||
@@ -2306,6 +2306,10 @@ free_buf_options(
|
||||
clear_string_option(&buf->b_p_fex);
|
||||
#endif
|
||||
#ifdef FEAT_CRYPT
|
||||
# ifdef FEAT_SODIUM
|
||||
if (buf->b_p_key != NULL && (crypt_get_method_nr(buf) == CRYPT_M_SOD))
|
||||
sodium_munlock(buf->b_p_key, STRLEN(buf->b_p_key));
|
||||
# endif
|
||||
clear_string_option(&buf->b_p_key);
|
||||
#endif
|
||||
clear_string_option(&buf->b_p_kp);
|
||||
|
||||
17
src/crypt.c
17
src/crypt.c
@@ -12,10 +12,6 @@
|
||||
*/
|
||||
#include "vim.h"
|
||||
|
||||
#ifdef FEAT_SODIUM
|
||||
# include <sodium.h>
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_CRYPT) || defined(PROTO)
|
||||
/*
|
||||
* Optional encryption support.
|
||||
@@ -447,6 +443,8 @@ crypt_free_state(cryptstate_T *state)
|
||||
#ifdef FEAT_SODIUM
|
||||
if (state->method_nr == CRYPT_M_SOD)
|
||||
{
|
||||
sodium_munlock(((sodium_state_T *)state->method_state)->key,
|
||||
crypto_box_SEEDBYTES);
|
||||
sodium_memzero(state->method_state, sizeof(sodium_state_T));
|
||||
sodium_free(state->method_state);
|
||||
}
|
||||
@@ -726,6 +724,7 @@ crypt_sodium_init(
|
||||
// crypto_box_SEEDBYTES == crypto_secretstream_xchacha20poly1305_KEYBYTES
|
||||
unsigned char dkey[crypto_box_SEEDBYTES]; // 32
|
||||
sodium_state_T *sd_state;
|
||||
int retval = 0;
|
||||
|
||||
if (sodium_init() < 0)
|
||||
return FAIL;
|
||||
@@ -743,6 +742,16 @@ crypt_sodium_init(
|
||||
return FAIL;
|
||||
}
|
||||
memcpy(sd_state->key, dkey, crypto_box_SEEDBYTES);
|
||||
|
||||
retval += sodium_mlock(sd_state->key, crypto_box_SEEDBYTES);
|
||||
retval += sodium_mlock(key, STRLEN(key));
|
||||
|
||||
if (retval < 0)
|
||||
{
|
||||
emsg(_(e_encryption_sodium_mlock_failed));
|
||||
sodium_free(sd_state);
|
||||
return FAIL;
|
||||
}
|
||||
sd_state->count = 0;
|
||||
state->method_state = sd_state;
|
||||
|
||||
|
||||
@@ -639,3 +639,7 @@ EXTERN char e_list_or_dict_required_for_argument_nr[]
|
||||
INIT(= N_("E1227: List or Dictionary required for argument %d"));
|
||||
EXTERN char e_list_or_dict_or_blob_required_for_argument_nr[]
|
||||
INIT(= N_("E1228: List or Dictionary or Blob required for argument %d"));
|
||||
EXTERN char e_expected_dictionary_for_using_key_str_but_got_str[]
|
||||
INIT(= N_("E1229: Expected dictionary for using key \"%s\", but got %s"));
|
||||
EXTERN char e_encryption_sodium_mlock_failed[]
|
||||
INIT(= N_("E1230: encryption: sodium_mlock() failed"));
|
||||
|
||||
@@ -817,6 +817,7 @@ ex_let(exarg_T *eap)
|
||||
else if (expr[0] == '=' && expr[1] == '<' && expr[2] == '<')
|
||||
{
|
||||
list_T *l;
|
||||
long cur_lnum = SOURCING_LNUM;
|
||||
|
||||
// HERE document
|
||||
l = heredoc_get(eap, expr + 3, FALSE);
|
||||
@@ -825,6 +826,8 @@ ex_let(exarg_T *eap)
|
||||
rettv_list_set(&rettv, l);
|
||||
if (!eap->skip)
|
||||
{
|
||||
// errors are for the assignment, not the end marker
|
||||
SOURCING_LNUM = cur_lnum;
|
||||
op[0] = '=';
|
||||
op[1] = NUL;
|
||||
(void)ex_let_vars(eap->arg, &rettv, FALSE, semicolon, var_count,
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
|
||||
#include "vim.h"
|
||||
|
||||
#ifdef FEAT_SODIUM
|
||||
# include <sodium.h>
|
||||
#endif
|
||||
|
||||
#if defined(__TANDEM)
|
||||
# include <limits.h> // for SSIZE_MAX
|
||||
#endif
|
||||
|
||||
@@ -882,6 +882,8 @@ EXTERN int VIsual_active INIT(= FALSE);
|
||||
// whether Visual mode is active
|
||||
EXTERN int VIsual_select INIT(= FALSE);
|
||||
// whether Select mode is active
|
||||
EXTERN int restart_VIsual_select INIT(= 0);
|
||||
// restart Select mode when next cmd finished
|
||||
EXTERN int VIsual_reselect;
|
||||
// whether to restart the selection after a
|
||||
// Select mode mapping or menu
|
||||
|
||||
24
src/if_lua.c
24
src/if_lua.c
@@ -1720,11 +1720,12 @@ static const luaL_Reg luaV_Window_mt[] = {
|
||||
static int
|
||||
luaV_print(lua_State *L)
|
||||
{
|
||||
int i, n = lua_gettop(L); // nargs
|
||||
const char *s;
|
||||
size_t l;
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
int i, n = lua_gettop(L); // nargs
|
||||
const char *s;
|
||||
size_t l;
|
||||
garray_T msg_ga;
|
||||
|
||||
ga_init2(&msg_ga, 1, 128);
|
||||
lua_getglobal(L, "tostring");
|
||||
for (i = 1; i <= n; i++)
|
||||
{
|
||||
@@ -1734,13 +1735,20 @@ luaV_print(lua_State *L)
|
||||
s = lua_tolstring(L, -1, &l);
|
||||
if (s == NULL)
|
||||
return luaL_error(L, "cannot convert to string");
|
||||
if (i > 1) luaL_addchar(&b, ' '); // use space instead of tab
|
||||
luaV_addlstring(&b, s, l, 0);
|
||||
if (i > 1)
|
||||
ga_append(&msg_ga, ' '); // use space instead of tab
|
||||
ga_concat_len(&msg_ga, (char_u *)s, l);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
luaL_pushresult(&b);
|
||||
// Replace any "\n" with "\0"
|
||||
for (i = 0; i < msg_ga.ga_len; i++)
|
||||
if (((char *)msg_ga.ga_data)[i] == '\n')
|
||||
((char *)msg_ga.ga_data)[i] = '\0';
|
||||
lua_pushlstring(L, msg_ga.ga_data, msg_ga.ga_len);
|
||||
if (!got_int)
|
||||
luaV_msg(L);
|
||||
|
||||
ga_clear(&msg_ga);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,11 +48,6 @@
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
// for randombytes_buf
|
||||
#ifdef FEAT_SODIUM
|
||||
# include <sodium.h>
|
||||
#endif
|
||||
|
||||
#if defined(SASC) || defined(__amigaos4__)
|
||||
# include <proto/dos.h> // for Open() and Close()
|
||||
#endif
|
||||
|
||||
@@ -652,7 +652,11 @@ f_mode(typval_T *argvars, typval_T *rettv)
|
||||
if (VIsual_select)
|
||||
buf[0] = VIsual_mode + 's' - 'v';
|
||||
else
|
||||
{
|
||||
buf[0] = VIsual_mode;
|
||||
if (restart_VIsual_select)
|
||||
buf[1] = 's';
|
||||
}
|
||||
}
|
||||
else if (State == HITRETURN || State == ASKMORE || State == SETWSIZE
|
||||
|| State == CONFIRM)
|
||||
@@ -2359,7 +2363,7 @@ get_cmd_output_as_rettv(
|
||||
|
||||
if (in_vim9script()
|
||||
&& (check_for_string_arg(argvars, 0) == FAIL
|
||||
|| check_for_string_or_number_or_list_arg(argvars, 1) == FAIL))
|
||||
|| check_for_opt_string_or_number_or_list_arg(argvars, 1) == FAIL))
|
||||
return;
|
||||
|
||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||
|
||||
16
src/misc2.c
16
src/misc2.c
@@ -1565,6 +1565,22 @@ ga_concat(garray_T *gap, char_u *s)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Concatenate 'len' bytes from string 's' to a growarray.
|
||||
* When "s" is NULL does not do anything.
|
||||
*/
|
||||
void
|
||||
ga_concat_len(garray_T *gap, char_u *s, size_t len)
|
||||
{
|
||||
if (s == NULL || *s == NUL)
|
||||
return;
|
||||
if (ga_grow(gap, len) == OK)
|
||||
{
|
||||
mch_memmove((char *)gap->ga_data + gap->ga_len, s, (size_t)len);
|
||||
gap->ga_len += len;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Append one byte to a growarray which contains bytes.
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "vim.h"
|
||||
|
||||
static int VIsual_mode_orig = NUL; // saved Visual mode
|
||||
static int restart_VIsual_select = 0;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
static void set_vcount_ca(cmdarg_T *cap, int *set_prevcount);
|
||||
|
||||
759
src/po/tr.po
759
src/po/tr.po
File diff suppressed because it is too large
Load Diff
@@ -45,6 +45,7 @@ int ga_grow_inner(garray_T *gap, int n);
|
||||
char_u *ga_concat_strings(garray_T *gap, char *sep);
|
||||
int ga_add_string(garray_T *gap, char_u *p);
|
||||
void ga_concat(garray_T *gap, char_u *s);
|
||||
void ga_concat_len(garray_T *gap, char_u *s, size_t len);
|
||||
void ga_append(garray_T *gap, int c);
|
||||
void append_ga_line(garray_T *gap);
|
||||
int simplify_key(int key, int *modifiers);
|
||||
|
||||
@@ -36,6 +36,7 @@ int check_for_string_or_list_arg(typval_T *args, int idx);
|
||||
int check_for_opt_string_or_list_arg(typval_T *args, int idx);
|
||||
int check_for_string_or_dict_arg(typval_T *args, int idx);
|
||||
int check_for_string_or_number_or_list_arg(typval_T *args, int idx);
|
||||
int check_for_opt_string_or_number_or_list_arg(typval_T *args, int idx);
|
||||
int check_for_string_or_list_or_dict_arg(typval_T *args, int idx);
|
||||
int check_for_list_or_blob_arg(typval_T *args, int idx);
|
||||
int check_for_list_or_dict_arg(typval_T *args, int idx);
|
||||
|
||||
@@ -746,6 +746,7 @@ func Test_mode()
|
||||
set complete=.
|
||||
|
||||
inoremap <F2> <C-R>=Save_mode()<CR>
|
||||
xnoremap <F2> <Cmd>call Save_mode()<CR>
|
||||
|
||||
normal! 3G
|
||||
exe "normal i\<F2>\<Esc>"
|
||||
@@ -857,6 +858,14 @@ func Test_mode()
|
||||
call assert_equal("\<C-S>", mode(1))
|
||||
call feedkeys("\<Esc>", 'xt')
|
||||
|
||||
" v_CTRL-O
|
||||
exe "normal gh\<C-O>\<F2>\<Esc>"
|
||||
call assert_equal("v-vs", g:current_modes)
|
||||
exe "normal gH\<C-O>\<F2>\<Esc>"
|
||||
call assert_equal("V-Vs", g:current_modes)
|
||||
exe "normal g\<C-H>\<C-O>\<F2>\<Esc>"
|
||||
call assert_equal("\<C-V>-\<C-V>s", g:current_modes)
|
||||
|
||||
call feedkeys(":echo \<C-R>=Save_mode()\<C-U>\<CR>", 'xt')
|
||||
call assert_equal('c-c', g:current_modes)
|
||||
call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt')
|
||||
@@ -867,6 +876,7 @@ func Test_mode()
|
||||
|
||||
bwipe!
|
||||
iunmap <F2>
|
||||
xunmap <F2>
|
||||
set complete&
|
||||
endfunc
|
||||
|
||||
|
||||
@@ -850,10 +850,28 @@ func Test_luafile_error()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test :luafile printing a long string
|
||||
func Test_luafile_print()
|
||||
new Xlua_file
|
||||
let lines =<< trim END
|
||||
local data = ''
|
||||
for i = 1, 130 do
|
||||
data = data .. 'xxxxx asd as as dad sad sad xz cxz czxcxzczxc ad ad asd asd asd asd asd'
|
||||
end
|
||||
print(data)
|
||||
END
|
||||
call setline(1, lines)
|
||||
w
|
||||
luafile %
|
||||
|
||||
call delete('Xlua_file')
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for dealing with strings containing newlines and null character
|
||||
func Test_lua_string_with_newline()
|
||||
let x = execute('lua print("Hello\nWorld")')
|
||||
call assert_equal("\nHello\nWorld", x)
|
||||
let x = execute('lua print("Hello\nWorld", 2)')
|
||||
call assert_equal("\nHello\nWorld 2", x)
|
||||
new
|
||||
lua k = vim.buffer(vim.eval('bufnr()'))
|
||||
lua k:insert("Hello\0World", 0)
|
||||
|
||||
@@ -39,7 +39,7 @@ endfunc
|
||||
|
||||
func Test_proptype_buf()
|
||||
let bufnr = bufnr('')
|
||||
call prop_type_add('comment', {'bufnr': bufnr, 'highlight': 'Directory', 'priority': 123, 'start_incl': 1, 'end_incl': 1})
|
||||
call prop_type_add('comment', #{bufnr: bufnr, highlight: 'Directory', priority: 123, start_incl: 1, end_incl: 1})
|
||||
let proptypes = prop_type_list({'bufnr': bufnr})
|
||||
call assert_equal(1, len(proptypes))
|
||||
call assert_equal('comment', proptypes[0])
|
||||
@@ -70,6 +70,36 @@ func Test_proptype_buf()
|
||||
call assert_fails("call prop_type_add('one', {'bufnr': 98764})", "E158:")
|
||||
endfunc
|
||||
|
||||
def Test_proptype_buf_list()
|
||||
new
|
||||
var bufnr = bufnr('')
|
||||
try
|
||||
prop_type_add('global', {})
|
||||
prop_type_add('local', {bufnr: bufnr})
|
||||
|
||||
prop_add(1, 1, {type: 'global'})
|
||||
prop_add(1, 1, {type: 'local'})
|
||||
|
||||
assert_equal([
|
||||
{type: 'local', type_bufnr: bufnr, id: 0, col: 1, end: 1, length: 0, start: 1},
|
||||
{type: 'global', type_bufnr: 0, id: 0, col: 1, end: 1, length: 0, start: 1},
|
||||
], prop_list(1))
|
||||
assert_equal(
|
||||
{lnum: 1, id: 0, col: 1, type_bufnr: bufnr, end: 1, type: 'local', length: 0, start: 1},
|
||||
prop_find({lnum: 1, type: 'local'}))
|
||||
assert_equal(
|
||||
{lnum: 1, id: 0, col: 1, type_bufnr: 0, end: 1, type: 'global', length: 0, start: 1},
|
||||
prop_find({lnum: 1, type: 'global'}))
|
||||
|
||||
prop_remove({type: 'global'}, 1)
|
||||
prop_remove({type: 'local'}, 1)
|
||||
finally
|
||||
prop_type_delete('global')
|
||||
prop_type_delete('local', {bufnr: bufnr})
|
||||
bwipe!
|
||||
endtry
|
||||
enddef
|
||||
|
||||
func AddPropTypes()
|
||||
call prop_type_add('one', {})
|
||||
call prop_type_add('two', {})
|
||||
@@ -94,27 +124,27 @@ endfunc
|
||||
|
||||
func Get_expected_props()
|
||||
return [
|
||||
\ {'col': 1, 'length': 13, 'id': 14, 'type': 'whole', 'start': 1, 'end': 1},
|
||||
\ {'col': 1, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
|
||||
\ {'col': 5, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
|
||||
\ {'col': 9, 'length': 5, 'id': 13, 'type': 'three', 'start': 1, 'end': 1},
|
||||
\ #{type_bufnr: 0, col: 1, length: 13, id: 14, type: 'whole', start: 1, end: 1},
|
||||
\ #{type_bufnr: 0, col: 1, length: 3, id: 11, type: 'one', start: 1, end: 1},
|
||||
\ #{type_bufnr: 0, col: 5, length: 3, id: 12, type: 'two', start: 1, end: 1},
|
||||
\ #{type_bufnr: 0, col: 9, length: 5, id: 13, type: 'three', start: 1, end: 1},
|
||||
\ ]
|
||||
endfunc
|
||||
|
||||
func Test_prop_find()
|
||||
new
|
||||
call setline(1, ['one one one', 'twotwo', 'three', 'fourfour', 'five', 'sixsix'])
|
||||
|
||||
" Add two text props on lines 1 and 5, and one spanning lines 2 to 4.
|
||||
|
||||
" Add two text props on lines 1 and 5, and one spanning lines 2 to 4.
|
||||
call prop_type_add('prop_name', {'highlight': 'Directory'})
|
||||
call prop_add(1, 5, {'type': 'prop_name', 'id': 10, 'length': 3})
|
||||
call prop_add(2, 4, {'type': 'prop_name', 'id': 11, 'end_lnum': 4, 'end_col': 9})
|
||||
call prop_add(5, 4, {'type': 'prop_name', 'id': 12, 'length': 1})
|
||||
|
||||
let expected = [
|
||||
\ {'lnum': 1, 'col': 5, 'length': 3, 'id': 10, 'type': 'prop_name', 'start': 1, 'end': 1},
|
||||
\ {'lnum': 2, 'col': 4, 'id': 11, 'type': 'prop_name', 'start': 1, 'end': 0},
|
||||
\ {'lnum': 5, 'col': 4, 'length': 1, 'id': 12, 'type': 'prop_name', 'start': 1, 'end': 1}
|
||||
\ #{type_bufnr: 0, lnum: 1, col: 5, length: 3, id: 10, type: 'prop_name', start: 1, end: 1},
|
||||
\ #{type_bufnr: 0, lnum: 2, col: 4, id: 11, type: 'prop_name', start: 1, end: 0},
|
||||
\ #{type_bufnr: 0, lnum: 5, col: 4, length: 1, id: 12, type: 'prop_name', start: 1, end: 1}
|
||||
\ ]
|
||||
|
||||
" Starting at line 5 col 1 this should find the prop at line 5 col 4.
|
||||
@@ -184,7 +214,7 @@ func Test_prop_find()
|
||||
let lnum = result.lnum
|
||||
let col = result.col
|
||||
let i = i - 1
|
||||
endwhile
|
||||
endwhile
|
||||
|
||||
" Starting from line 6 col 1 search backwards for prop with id 10.
|
||||
call cursor(6,1)
|
||||
@@ -226,7 +256,7 @@ def Test_prop_find2()
|
||||
endfor
|
||||
endfor
|
||||
cursor(1, 8)
|
||||
var expected = {lnum: 1, id: 0, col: 14, end: 1, type: 'misspell', length: 2, start: 1}
|
||||
var expected = {type_bufnr: 0, lnum: 1, id: 0, col: 14, end: 1, type: 'misspell', length: 2, start: 1}
|
||||
var result = prop_find({type: 'misspell', skipstart: true}, 'f')
|
||||
assert_equal(expected, result)
|
||||
|
||||
@@ -239,7 +269,8 @@ func Test_prop_find_smaller_len_than_match_col()
|
||||
call prop_type_add('test', {'highlight': 'ErrorMsg'})
|
||||
call setline(1, ['xxxx', 'x'])
|
||||
call prop_add(1, 4, {'type': 'test'})
|
||||
call assert_equal({'id': 0, 'lnum': 1, 'col': 4, 'type': 'test', 'length': 0, 'start': 1, 'end': 1},
|
||||
call assert_equal(
|
||||
\ #{type_bufnr: 0, id: 0, lnum: 1, col: 4, type: 'test', length: 0, start: 1, end: 1},
|
||||
\ prop_find({'type': 'test', 'lnum': 2, 'col': 1}, 'b'))
|
||||
bwipe!
|
||||
call prop_type_delete('test')
|
||||
@@ -272,7 +303,7 @@ func Test_prop_add()
|
||||
call assert_equal(expected_props, prop_list(1))
|
||||
call assert_fails("call prop_add(10, 1, {'length': 1, 'id': 14, 'type': 'whole'})", 'E966:')
|
||||
call assert_fails("call prop_add(1, 22, {'length': 1, 'id': 14, 'type': 'whole'})", 'E964:')
|
||||
|
||||
|
||||
" Insert a line above, text props must still be there.
|
||||
call append(0, 'empty')
|
||||
call assert_equal(expected_props, prop_list(2))
|
||||
@@ -284,12 +315,12 @@ func Test_prop_add()
|
||||
call prop_clear(1)
|
||||
call prop_type_add('included', {'start_incl': 1, 'end_incl': 1})
|
||||
call prop_add(1, 5, #{type: 'included'})
|
||||
let expected = [#{col: 5, length: 0, type: 'included', id: 0, start: 1, end: 1}]
|
||||
let expected = [#{type_bufnr: 0, col: 5, length: 0, type: 'included', id: 0, start: 1, end: 1}]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
|
||||
" Inserting text makes the prop bigger.
|
||||
exe "normal 5|ixx\<Esc>"
|
||||
let expected = [#{col: 5, length: 2, type: 'included', id: 0, start: 1, end: 1}]
|
||||
let expected = [#{type_bufnr: 0, col: 5, length: 2, type: 'included', id: 0, start: 1, end: 1}]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
|
||||
call assert_fails("call prop_add(1, 5, {'type': 'two', 'bufnr': 234343})", 'E158:')
|
||||
@@ -327,7 +358,7 @@ func Test_prop_remove()
|
||||
call SetupPropsInFirstLine()
|
||||
call prop_add(1, 6, {'length': 2, 'id': 11, 'type': 'three'})
|
||||
let props = Get_expected_props()
|
||||
call insert(props, {'col': 6, 'length': 2, 'id': 11, 'type': 'three', 'start': 1, 'end': 1}, 3)
|
||||
call insert(props, #{type_bufnr: 0, col: 6, length: 2, id: 11, type: 'three', start: 1, end: 1}, 3)
|
||||
call assert_equal(props, prop_list(1))
|
||||
call assert_equal(1, prop_remove({'type': 'three', 'id': 11, 'both': 1, 'all': 1}, 1))
|
||||
unlet props[3]
|
||||
@@ -367,8 +398,8 @@ func SetupOneLine()
|
||||
call prop_add(1, 2, {'length': 3, 'id': 11, 'type': 'one'})
|
||||
call prop_add(1, 8, {'length': 3, 'id': 12, 'type': 'two'})
|
||||
let expected = [
|
||||
\ {'col': 2, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
|
||||
\ {'col': 8, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
|
||||
\ #{type_bufnr: 0, col: 2, length: 3, id: 11, type: 'one', start: 1, end: 1},
|
||||
\ #{type_bufnr: 0, col: 8, length: 3, id: 12, type: 'two', start: 1, end: 1},
|
||||
\]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
return expected
|
||||
@@ -389,9 +420,9 @@ func Test_prop_add_remove_buf()
|
||||
endfor
|
||||
|
||||
let props = [
|
||||
\ {'col': 1, 'length': 3, 'id': 11, 'type': 'one', 'start': 1, 'end': 1},
|
||||
\ {'col': 5, 'length': 3, 'id': 12, 'type': 'two', 'start': 1, 'end': 1},
|
||||
\ {'col': 11, 'length': 3, 'id': 13, 'type': 'three', 'start': 1, 'end': 1},
|
||||
\ #{type_bufnr: 0, col: 1, length: 3, id: 11, type: 'one', start: 1, end: 1},
|
||||
\ #{type_bufnr: 0, col: 5, length: 3, id: 12, type: 'two', start: 1, end: 1},
|
||||
\ #{type_bufnr: 0, col: 11, length: 3, id: 13, type: 'three', start: 1, end: 1},
|
||||
\]
|
||||
call assert_equal(props, prop_list(1, {'bufnr': bufnr}))
|
||||
|
||||
@@ -658,7 +689,7 @@ func Test_prop_change_indent()
|
||||
new
|
||||
call setline(1, [' xxx', 'yyyyy'])
|
||||
call prop_add(2, 2, {'length': 2, 'type': 'comment'})
|
||||
let expect = {'col': 2, 'length': 2, 'type': 'comment', 'start': 1, 'end': 1, 'id': 0}
|
||||
let expect = #{type_bufnr: 0, col: 2, length: 2, type: 'comment', start: 1, end: 1, id: 0}
|
||||
call assert_equal([expect], prop_list(2))
|
||||
|
||||
set shiftwidth=3
|
||||
@@ -704,11 +735,11 @@ func Test_prop_multiline()
|
||||
|
||||
" start halfway line 1, end halfway line 3
|
||||
call prop_add(1, 3, {'end_lnum': 3, 'end_col': 5, 'type': 'comment'})
|
||||
let expect1 = {'col': 3, 'length': 6, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
|
||||
let expect1 = #{type_bufnr: 0, col: 3, length: 6, type: 'comment', start: 1, end: 0, id: 0}
|
||||
call assert_equal([expect1], prop_list(1))
|
||||
let expect2 = {'col': 1, 'length': 10, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
|
||||
let expect2 = #{type_bufnr: 0, col: 1, length: 10, type: 'comment', start: 0, end: 0, id: 0}
|
||||
call assert_equal([expect2], prop_list(2))
|
||||
let expect3 = {'col': 1, 'length': 4, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0}
|
||||
let expect3 = #{type_bufnr: 0, col: 1, length: 4, type: 'comment', start: 0, end: 1, id: 0}
|
||||
call assert_equal([expect3], prop_list(3))
|
||||
call prop_clear(1, 3)
|
||||
|
||||
@@ -726,21 +757,21 @@ func Test_prop_multiline()
|
||||
|
||||
" Test deleting the first line of a multi-line prop.
|
||||
call Setup_three_line_prop()
|
||||
let expect_short = {'col': 2, 'length': 1, 'type': 'comment', 'start': 1, 'end': 1, 'id': 0}
|
||||
let expect_short = #{type_bufnr: 0, col: 2, length: 1, type: 'comment', start: 1, end: 1, id: 0}
|
||||
call assert_equal([expect_short], prop_list(1))
|
||||
let expect2 = {'col': 4, 'length': 4, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
|
||||
let expect2 = #{type_bufnr: 0, col: 4, length: 4, type: 'comment', start: 1, end: 0, id: 0}
|
||||
call assert_equal([expect2], prop_list(2))
|
||||
2del
|
||||
call assert_equal([expect_short], prop_list(1))
|
||||
let expect2 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
|
||||
let expect2 = #{type_bufnr: 0, col: 1, length: 6, type: 'comment', start: 1, end: 0, id: 0}
|
||||
call assert_equal([expect2], prop_list(2))
|
||||
bwipe!
|
||||
|
||||
" Test deleting the last line of a multi-line prop.
|
||||
call Setup_three_line_prop()
|
||||
let expect3 = {'col': 1, 'length': 6, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
|
||||
let expect3 = #{type_bufnr: 0, col: 1, length: 6, type: 'comment', start: 0, end: 0, id: 0}
|
||||
call assert_equal([expect3], prop_list(3))
|
||||
let expect4 = {'col': 1, 'length': 4, 'type': 'comment', 'start': 0, 'end': 1, 'id': 0}
|
||||
let expect4 = #{type_bufnr: 0, col: 1, length: 4, type: 'comment', start: 0, end: 1, id: 0}
|
||||
call assert_equal([expect4], prop_list(4))
|
||||
4del
|
||||
let expect3.end = 1
|
||||
@@ -750,11 +781,11 @@ func Test_prop_multiline()
|
||||
|
||||
" Test appending a line below the multi-line text prop start.
|
||||
call Setup_three_line_prop()
|
||||
let expect2 = {'col': 4, 'length': 4, 'type': 'comment', 'start': 1, 'end': 0, 'id': 0}
|
||||
let expect2 = #{type_bufnr: 0, col: 4, length: 4, type: 'comment', start: 1, end: 0, id: 0}
|
||||
call assert_equal([expect2], prop_list(2))
|
||||
call append(2, "new line")
|
||||
call assert_equal([expect2], prop_list(2))
|
||||
let expect3 = {'col': 1, 'length': 9, 'type': 'comment', 'start': 0, 'end': 0, 'id': 0}
|
||||
let expect3 = #{type_bufnr: 0, col: 1, length: 9, type: 'comment', start: 0, end: 0, id: 0}
|
||||
call assert_equal([expect3], prop_list(3))
|
||||
bwipe!
|
||||
|
||||
@@ -828,7 +859,7 @@ func Test_prop_undo()
|
||||
set ul&
|
||||
|
||||
call prop_add(1, 3, {'end_col': 5, 'type': 'comment'})
|
||||
let expected = [{'col': 3, 'length': 2, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
|
||||
let expected = [#{type_bufnr: 0, col: 3, length: 2, id: 0, type: 'comment', start: 1, end: 1}]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
|
||||
" Insert a character, then undo.
|
||||
@@ -872,7 +903,7 @@ func Test_prop_undo()
|
||||
" substitute a word, then undo
|
||||
call setline(1, 'the number 123 is highlighted.')
|
||||
call prop_add(1, 12, {'length': 3, 'type': 'comment'})
|
||||
let expected = [{'col': 12, 'length': 3, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
|
||||
let expected = [#{type_bufnr: 0, col: 12, length: 3, id: 0, type: 'comment', start: 1, end: 1} ]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
set ul&
|
||||
1s/number/foo
|
||||
@@ -886,7 +917,7 @@ func Test_prop_undo()
|
||||
" substitute with backslash
|
||||
call setline(1, 'the number 123 is highlighted.')
|
||||
call prop_add(1, 12, {'length': 3, 'type': 'comment'})
|
||||
let expected = [{'col': 12, 'length': 3, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
|
||||
let expected = [#{type_bufnr: 0, col: 12, length: 3, id: 0, type: 'comment', start: 1, end: 1} ]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
1s/the/\The
|
||||
call assert_equal(expected, prop_list(1))
|
||||
@@ -912,22 +943,22 @@ func Test_prop_delete_text()
|
||||
|
||||
" zero length property
|
||||
call prop_add(1, 3, {'type': 'comment'})
|
||||
let expected = [{'col': 3, 'length': 0, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
|
||||
let expected = [#{type_bufnr: 0, col: 3, length: 0, id: 0, type: 'comment', start: 1, end: 1} ]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
|
||||
" delete one char moves the property
|
||||
normal! x
|
||||
let expected = [{'col': 2, 'length': 0, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
|
||||
let expected = [#{type_bufnr: 0, col: 2, length: 0, id: 0, type: 'comment', start: 1, end: 1} ]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
|
||||
" delete char of the property has no effect
|
||||
normal! lx
|
||||
let expected = [{'col': 2, 'length': 0, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
|
||||
let expected = [#{type_bufnr: 0, col: 2, length: 0, id: 0, type: 'comment', start: 1, end: 1} ]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
|
||||
" delete more chars moves property to first column, is not deleted
|
||||
normal! 0xxxx
|
||||
let expected = [{'col': 1, 'length': 0, 'id': 0, 'type': 'comment', 'start': 1, 'end': 1} ]
|
||||
let expected = [#{type_bufnr: 0, col: 1, length: 0, id: 0, type: 'comment', start: 1, end: 1} ]
|
||||
call assert_equal(expected, prop_list(1))
|
||||
|
||||
bwipe!
|
||||
@@ -1191,12 +1222,16 @@ func Test_proptype_substitute2()
|
||||
call prop_add(2, 1, {'length': 3, 'type': 'number'})
|
||||
call prop_add(3, 36, {'length': 4, 'type': 'number'})
|
||||
set ul&
|
||||
let expected = [{'id': 0, 'col': 13, 'end': 1, 'type': 'number', 'length': 3, 'start': 1},
|
||||
\ {'id': 0, 'col': 1, 'end': 1, 'type': 'number', 'length': 3, 'start': 1},
|
||||
\ {'id': 0, 'col': 50, 'end': 1, 'type': 'number', 'length': 4, 'start': 1}]
|
||||
let expected = [
|
||||
\ #{type_bufnr: 0, id: 0, col: 13, end: 1, type: 'number', length: 3, start: 1},
|
||||
\ #{type_bufnr: 0, id: 0, col: 1, end: 1, type: 'number', length: 3, start: 1},
|
||||
\ #{type_bufnr: 0, id: 0, col: 50, end: 1, type: 'number', length: 4, start: 1}]
|
||||
|
||||
" TODO
|
||||
return
|
||||
" Add some text in between
|
||||
%s/\s\+/ /g
|
||||
call assert_equal(expected, prop_list(1) + prop_list(2) + prop_list(3))
|
||||
call assert_equal(expected, prop_list(1) + prop_list(2) + prop_list(3))
|
||||
|
||||
" remove some text
|
||||
:1s/[a-z]\{3\}//g
|
||||
@@ -1298,11 +1333,11 @@ func Test_textprop_ins_str()
|
||||
call setline(1, 'just some text')
|
||||
call prop_type_add('test', {'highlight': 'ErrorMsg'})
|
||||
call prop_add(1, 1, {'end_col': 2, 'type': 'test'})
|
||||
call assert_equal([{'id': 0, 'col': 1, 'end': 1, 'type': 'test', 'length': 1, 'start': 1}], prop_list(1))
|
||||
call assert_equal([#{type_bufnr: 0, id: 0, col: 1, end: 1, type: 'test', length: 1, start: 1}], prop_list(1))
|
||||
|
||||
call feedkeys("foi\<F8>\<Esc>", "tx")
|
||||
call assert_equal('just s<F8>ome text', getline(1))
|
||||
call assert_equal([{'id': 0, 'col': 1, 'end': 1, 'type': 'test', 'length': 1, 'start': 1}], prop_list(1))
|
||||
call assert_equal([#{type_bufnr: 0, id: 0, col: 1, end: 1, type: 'test', length: 1, start: 1}], prop_list(1))
|
||||
|
||||
bwipe!
|
||||
call prop_remove({'type': 'test'})
|
||||
@@ -1316,8 +1351,9 @@ func Test_find_prop_later_in_line()
|
||||
call prop_add(1, 1, {'length': 4, 'type': 'test'})
|
||||
call prop_add(1, 10, {'length': 3, 'type': 'test'})
|
||||
|
||||
call assert_equal({'id': 0, 'lnum': 1, 'col': 10, 'end': 1, 'type': 'test', 'length': 3, 'start': 1},
|
||||
\ prop_find(#{type: 'test', lnum: 1, col: 6}))
|
||||
call assert_equal(
|
||||
\ #{type_bufnr: 0, id: 0, lnum: 1, col: 10, end: 1, type: 'test', length: 3, start: 1},
|
||||
\ prop_find(#{type: 'test', lnum: 1, col: 6}))
|
||||
|
||||
bwipe!
|
||||
call prop_type_delete('test')
|
||||
@@ -1329,8 +1365,9 @@ func Test_find_zerowidth_prop_sol()
|
||||
call setline(1, 'just some text')
|
||||
call prop_add(1, 1, {'length': 0, 'type': 'test'})
|
||||
|
||||
call assert_equal({'id': 0, 'lnum': 1, 'col': 1, 'end': 1, 'type': 'test', 'length': 0, 'start': 1},
|
||||
\ prop_find(#{type: 'test', lnum: 1}))
|
||||
call assert_equal(
|
||||
\ #{type_bufnr: 0, id: 0, lnum: 1, col: 1, end: 1, type: 'test', length: 0, start: 1},
|
||||
\ prop_find(#{type: 'test', lnum: 1}))
|
||||
|
||||
bwipe!
|
||||
call prop_type_delete('test')
|
||||
@@ -1386,14 +1423,16 @@ func Test_prop_split_join()
|
||||
|
||||
" Split in middle of "some"
|
||||
execute "normal! 8|i\<CR>"
|
||||
call assert_equal([{'id': 0, 'col': 6, 'end': 0, 'type': 'test', 'length': 2, 'start': 1}],
|
||||
\ prop_list(1))
|
||||
call assert_equal([{'id': 0, 'col': 1, 'end': 1, 'type': 'test', 'length': 2, 'start': 0}],
|
||||
\ prop_list(2))
|
||||
call assert_equal(
|
||||
\ [#{type_bufnr: 0, id: 0, col: 6, end: 0, type: 'test', length: 2, start: 1}],
|
||||
\ prop_list(1))
|
||||
call assert_equal(
|
||||
\ [#{type_bufnr: 0, id: 0, col: 1, end: 1, type: 'test', length: 2, start: 0}],
|
||||
\ prop_list(2))
|
||||
|
||||
" Join the two lines back together
|
||||
normal! 1GJ
|
||||
call assert_equal([{'id': 0, 'col': 6, 'end': 1, 'type': 'test', 'length': 5, 'start': 1}], prop_list(1))
|
||||
call assert_equal([#{type_bufnr: 0, id: 0, col: 6, end: 1, type: 'test', length: 5, start: 1}], prop_list(1))
|
||||
|
||||
bwipe!
|
||||
call prop_type_delete('test')
|
||||
@@ -1408,12 +1447,12 @@ func Test_prop_increment_decrement()
|
||||
exe "normal! 0f9\<C-A>"
|
||||
eval getline(1)->assert_equal('its 999 times')
|
||||
eval prop_list(1)->assert_equal([
|
||||
\ #{id: 0, col: 5, end: 1, type: 'test', length: 3, start: 1}])
|
||||
\ #{type_bufnr: 0, id: 0, col: 5, end: 1, type: 'test', length: 3, start: 1}])
|
||||
|
||||
exe "normal! 0f9\<C-A>"
|
||||
eval getline(1)->assert_equal('its 1000 times')
|
||||
eval prop_list(1)->assert_equal([
|
||||
\ #{id: 0, col: 5, end: 1, type: 'test', length: 4, start: 1}])
|
||||
\ #{type_bufnr: 0, id: 0, col: 5, end: 1, type: 'test', length: 4, start: 1}])
|
||||
|
||||
bwipe!
|
||||
call prop_type_delete('test')
|
||||
@@ -1429,7 +1468,7 @@ func Test_prop_block_insert()
|
||||
" insert "xx" in the first column of both lines
|
||||
exe "normal! gg0\<C-V>jIxx\<Esc>"
|
||||
eval getline(1, 2)->assert_equal(['xxone ', 'xxtwo '])
|
||||
let expected = [#{id: 0, col: 3, end: 1, type: 'test', length: 3, start: 1}]
|
||||
let expected = [#{type_bufnr: 0, id: 0, col: 3, end: 1, type: 'test', length: 3, start: 1}]
|
||||
eval prop_list(1)->assert_equal(expected)
|
||||
eval prop_list(2)->assert_equal(expected)
|
||||
|
||||
@@ -1510,5 +1549,37 @@ def Test_prop_add_delete_line()
|
||||
bwipe!
|
||||
enddef
|
||||
|
||||
" Buffer number of 0 should be ignored, as if the parameter wasn't passed.
|
||||
def Test_prop_bufnr_zero()
|
||||
new
|
||||
try
|
||||
var bufnr = bufnr('')
|
||||
setline(1, 'hello')
|
||||
prop_type_add('bufnr-global', {highlight: 'ErrorMsg'})
|
||||
prop_type_add('bufnr-buffer', {highlight: 'StatusLine', bufnr: bufnr})
|
||||
|
||||
prop_add(1, 1, {type: 'bufnr-global', length: 1})
|
||||
prop_add(1, 2, {type: 'bufnr-buffer', length: 1})
|
||||
|
||||
var list = prop_list(1)
|
||||
assert_equal([
|
||||
{id: 0, col: 1, type_bufnr: 0, end: 1, type: 'bufnr-global', length: 1, start: 1},
|
||||
{id: 0, col: 2, type_bufnr: bufnr, end: 1, type: 'bufnr-buffer', length: 1, start: 1},
|
||||
], list)
|
||||
|
||||
assert_equal(
|
||||
{highlight: 'ErrorMsg', end_incl: 0, start_incl: 0, priority: 0, combine: 1},
|
||||
prop_type_get('bufnr-global', {bufnr: list[0].type_bufnr}))
|
||||
|
||||
assert_equal(
|
||||
{highlight: 'StatusLine', end_incl: 0, start_incl: 0, priority: 0, bufnr: bufnr, combine: 1},
|
||||
prop_type_get('bufnr-buffer', {bufnr: list[1].type_bufnr}))
|
||||
finally
|
||||
bwipe!
|
||||
prop_type_delete('bufnr-global')
|
||||
endtry
|
||||
enddef
|
||||
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -632,6 +632,13 @@ func Test_usercmd_with_block()
|
||||
call assert_equal('more', g:didmore)
|
||||
unlet g:didit
|
||||
unlet g:didmore
|
||||
delcommand DoSomething
|
||||
|
||||
command DoMap {
|
||||
echo [1, 2, 3]->map((_, v) => v + 1)
|
||||
}
|
||||
DoMap
|
||||
delcommand DoMap
|
||||
|
||||
let lines =<< trim END
|
||||
command DoesNotEnd {
|
||||
|
||||
@@ -1392,6 +1392,14 @@ def Test_heredoc()
|
||||
[END]
|
||||
CheckScriptFailure(lines, 'E1145: Missing heredoc end marker: END')
|
||||
delfunc! g:Func
|
||||
|
||||
lines =<< trim END
|
||||
var lines: number =<< trim STOP
|
||||
aaa
|
||||
bbb
|
||||
STOP
|
||||
END
|
||||
CheckDefAndScriptFailure(lines, 'E1012: Type mismatch; expected number but got list<string>', 1)
|
||||
enddef
|
||||
|
||||
def Test_var_func_call()
|
||||
@@ -2002,5 +2010,20 @@ def Test_inc_dec()
|
||||
CheckDefAndScriptFailure(lines, "E1202: No white space allowed after '++': ++ nr")
|
||||
enddef
|
||||
|
||||
def Test_abort_after_error()
|
||||
# should abort after strpart() fails, not give another type error
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
var x: string
|
||||
x = strpart(1, 2)
|
||||
END
|
||||
writefile(lines, 'Xtestscript')
|
||||
var expected = 'E1174: String required for argument 1'
|
||||
assert_fails('so Xtestscript', [expected, expected], 3)
|
||||
|
||||
delete('Xtestscript')
|
||||
enddef
|
||||
|
||||
|
||||
|
||||
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
|
||||
|
||||
@@ -3239,8 +3239,8 @@ def Test_substitute()
|
||||
assert_equal('AX234', res)
|
||||
|
||||
if has('job')
|
||||
assert_fails('"text"->substitute(".*", () => job_start(":"), "")', 'E908: using an invalid value as a String: job')
|
||||
assert_fails('"text"->substitute(".*", () => job_start(":")->job_getchannel(), "")', 'E908: using an invalid value as a String: channel')
|
||||
assert_fails('"text"->substitute(".*", () => test_null_job(), "")', 'E908: using an invalid value as a String: job')
|
||||
assert_fails('"text"->substitute(".*", () => test_null_channel(), "")', 'E908: using an invalid value as a String: channel')
|
||||
endif
|
||||
CheckDefAndScriptFailure2(['substitute(1, "b", "1", "d")'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
|
||||
CheckDefAndScriptFailure2(['substitute("a", 2, "1", "d")'], 'E1013: Argument 2: type mismatch, expected string but got number', 'E1174: String required for argument 2')
|
||||
@@ -3290,11 +3290,17 @@ enddef
|
||||
def Test_system()
|
||||
CheckDefAndScriptFailure2(['system(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
|
||||
CheckDefAndScriptFailure2(['system("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1224: String or List required for argument 2')
|
||||
assert_equal("123\n", system('echo 123'))
|
||||
enddef
|
||||
|
||||
def Test_systemlist()
|
||||
CheckDefAndScriptFailure2(['systemlist(1)'], 'E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1')
|
||||
CheckDefAndScriptFailure2(['systemlist("a", {})'], 'E1013: Argument 2: type mismatch, expected string but got dict<unknown>', 'E1224: String or List required for argument 2')
|
||||
if has('win32')
|
||||
call assert_equal(["123\r"], systemlist('echo 123'))
|
||||
else
|
||||
call assert_equal(['123'], systemlist('echo 123'))
|
||||
endif
|
||||
enddef
|
||||
|
||||
def Test_tabpagebuflist()
|
||||
|
||||
@@ -3114,7 +3114,7 @@ func Test_expr7_fails()
|
||||
call CheckDefExecAndScriptFailure(["var x = +g:alist"], 'E745:', 1)
|
||||
call CheckDefExecAndScriptFailure(["var x = +g:adict"], 'E728:', 1)
|
||||
|
||||
call CheckDefAndScriptFailure2(["var x = ''", "var y = x.memb"], 'E715:', 'E488:', 2)
|
||||
call CheckDefAndScriptFailure2(["var x = ''", "var y = x.memb"], 'E1229: Expected dictionary for using key "memb", but got string', 'E488:', 2)
|
||||
|
||||
call CheckDefAndScriptFailure2(["'yes'->", "Echo()"], 'E488: Trailing characters: ->', 'E260: Missing name after ->', 1)
|
||||
|
||||
|
||||
@@ -140,7 +140,8 @@ get_bufnr_from_arg(typval_T *arg, buf_T **buf)
|
||||
if (arg->vval.v_dict == NULL)
|
||||
return OK; // NULL dict is like an empty dict
|
||||
di = dict_find(arg->vval.v_dict, (char_u *)"bufnr", -1);
|
||||
if (di != NULL)
|
||||
if (di != NULL && (di->di_tv.v_type != VAR_NUMBER
|
||||
|| di->di_tv.vval.v_number != 0))
|
||||
{
|
||||
*buf = get_buf_arg(&di->di_tv);
|
||||
if (*buf == NULL)
|
||||
@@ -506,15 +507,27 @@ find_type_by_id(hashtab_T *ht, int id)
|
||||
prop_fill_dict(dict_T *dict, textprop_T *prop, buf_T *buf)
|
||||
{
|
||||
proptype_T *pt;
|
||||
int buflocal = TRUE;
|
||||
|
||||
dict_add_number(dict, "col", prop->tp_col);
|
||||
dict_add_number(dict, "length", prop->tp_len);
|
||||
dict_add_number(dict, "id", prop->tp_id);
|
||||
dict_add_number(dict, "start", !(prop->tp_flags & TP_FLAG_CONT_PREV));
|
||||
dict_add_number(dict, "end", !(prop->tp_flags & TP_FLAG_CONT_NEXT));
|
||||
pt = text_prop_type_by_id(buf, prop->tp_type);
|
||||
|
||||
pt = find_type_by_id(buf->b_proptypes, prop->tp_type);
|
||||
if (pt == NULL)
|
||||
{
|
||||
pt = find_type_by_id(global_proptypes, prop->tp_type);
|
||||
buflocal = FALSE;
|
||||
}
|
||||
if (pt != NULL)
|
||||
dict_add_string(dict, "type", pt->pt_name);
|
||||
|
||||
if (buflocal)
|
||||
dict_add_number(dict, "type_bufnr", buf->b_fnum);
|
||||
else
|
||||
dict_add_number(dict, "type_bufnr", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1159,7 +1172,7 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
}
|
||||
|
||||
/*
|
||||
* prop_type_get({name} [, {bufnr}])
|
||||
* prop_type_get({name} [, {props}])
|
||||
*/
|
||||
void
|
||||
f_prop_type_get(typval_T *argvars, typval_T *rettv)
|
||||
|
||||
11
src/typval.c
11
src/typval.c
@@ -726,6 +726,17 @@ check_for_string_or_number_or_list_arg(typval_T *args, int idx)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Give an error and return FAIL unless "args[idx]" is an optional string
|
||||
* or number or a list
|
||||
*/
|
||||
int
|
||||
check_for_opt_string_or_number_or_list_arg(typval_T *args, int idx)
|
||||
{
|
||||
return (args[idx].v_type == VAR_UNKNOWN
|
||||
|| check_for_string_or_number_or_list_arg(args, idx) != FAIL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Give an error and return FAIL unless "args[idx]" is a string or a list
|
||||
* or a dict.
|
||||
|
||||
@@ -1398,7 +1398,7 @@ get_lambda_tv(
|
||||
|
||||
// If there are line breaks, we need to split up the string.
|
||||
line_end = vim_strchr(start, '\n');
|
||||
if (line_end == NULL)
|
||||
if (line_end == NULL || line_end > end)
|
||||
line_end = end;
|
||||
|
||||
// Add "return " before the expression (or the first line).
|
||||
@@ -1674,7 +1674,8 @@ get_func_tv(
|
||||
|
||||
if (ret == OK)
|
||||
{
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
int did_emsg_before = did_emsg;
|
||||
|
||||
if (get_vim_var_nr(VV_TESTING))
|
||||
{
|
||||
@@ -1689,6 +1690,13 @@ get_func_tv(
|
||||
}
|
||||
|
||||
ret = call_func(name, len, rettv, argcount, argvars, funcexe);
|
||||
if (in_vim9script() && did_emsg > did_emsg_before)
|
||||
{
|
||||
// An error in a builtin function does not return FAIL, but we do
|
||||
// want to abort further processing if an error was given.
|
||||
ret = FAIL;
|
||||
clear_tv(rettv);
|
||||
}
|
||||
|
||||
funcargs.ga_len -= i;
|
||||
}
|
||||
|
||||
@@ -755,6 +755,34 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
3245,
|
||||
/**/
|
||||
3244,
|
||||
/**/
|
||||
3243,
|
||||
/**/
|
||||
3242,
|
||||
/**/
|
||||
3241,
|
||||
/**/
|
||||
3240,
|
||||
/**/
|
||||
3239,
|
||||
/**/
|
||||
3238,
|
||||
/**/
|
||||
3237,
|
||||
/**/
|
||||
3236,
|
||||
/**/
|
||||
3235,
|
||||
/**/
|
||||
3234,
|
||||
/**/
|
||||
3233,
|
||||
/**/
|
||||
3232,
|
||||
/**/
|
||||
3231,
|
||||
/**/
|
||||
|
||||
@@ -486,6 +486,10 @@ typedef unsigned int u8char_T; // int is 32 bits or more
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SODIUM
|
||||
# include <sodium.h>
|
||||
#endif
|
||||
|
||||
// ================ end of the header file puzzle ===============
|
||||
|
||||
/*
|
||||
|
||||
@@ -2177,7 +2177,11 @@ generate_STRINGMEMBER(cctx_T *cctx, char_u *name, size_t len)
|
||||
type = ((type_T **)stack->ga_data)[stack->ga_len - 1];
|
||||
if (type->tt_type != VAR_DICT && type != &t_any)
|
||||
{
|
||||
emsg(_(e_dictreq));
|
||||
char *tofree;
|
||||
|
||||
semsg(_(e_expected_dictionary_for_using_key_str_but_got_str),
|
||||
name, type_name(type, &tofree));
|
||||
vim_free(tofree);
|
||||
return FAIL;
|
||||
}
|
||||
// change dict type to dict member type
|
||||
@@ -6871,7 +6875,15 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
||||
if (compile_assign_lhs(var_start, &lhs, cmdidx,
|
||||
is_decl, heredoc, oplen, cctx) == FAIL)
|
||||
goto theend;
|
||||
if (!heredoc)
|
||||
if (heredoc)
|
||||
{
|
||||
SOURCING_LNUM = start_lnum;
|
||||
if (lhs.lhs_has_type
|
||||
&& need_type(&t_list_string, lhs.lhs_type,
|
||||
-1, 0, cctx, FALSE, FALSE) == FAIL)
|
||||
goto theend;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cctx->ctx_skip == SKIP_YES)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user