mirror of
https://github.com/zoriya/vim.git
synced 2025-12-31 03:18:25 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acbae18df5 | ||
|
|
b5b9480ee9 | ||
|
|
e498429087 | ||
|
|
c530852315 | ||
|
|
93f82cbee5 | ||
|
|
57f799e6a4 | ||
|
|
2a9d5d386b | ||
|
|
3ae50c775c | ||
|
|
709664cca0 | ||
|
|
cc2335896b | ||
|
|
0ea7421ae6 | ||
|
|
100118c73a | ||
|
|
1b884a0053 | ||
|
|
70249ee831 | ||
|
|
0e12140550 | ||
|
|
8f1bf2ef78 | ||
|
|
08597875b2 | ||
|
|
d356fc65d2 |
24
.github/CODEOWNERS
vendored
24
.github/CODEOWNERS
vendored
@@ -20,6 +20,7 @@ runtime/autoload/rubycomplete.vim @segfault @dkearns
|
||||
runtime/autoload/tar.vim @cecamp
|
||||
runtime/autoload/vimball.vim @cecamp
|
||||
runtime/autoload/zip.vim @cecamp
|
||||
runtime/autoload/xmlformat.vim @chrisbra
|
||||
runtime/compiler/checkstyle.vim @dkearns
|
||||
runtime/compiler/cucumber.vim @tpope
|
||||
runtime/compiler/dart.vim @dkearns
|
||||
@@ -57,6 +58,7 @@ runtime/compiler/tsc.vim @dkearns
|
||||
runtime/compiler/typedoc.vim @dkearns
|
||||
runtime/compiler/xmllint.vim @dkearns
|
||||
runtime/compiler/xo.vim @dkearns
|
||||
runtime/compiler/zsh.vim @dkearns
|
||||
runtime/doc/pi_getscript.txt @cecamp
|
||||
runtime/doc/pi_logipat.txt @cecamp
|
||||
runtime/doc/pi_netrw.txt @cecamp
|
||||
@@ -65,6 +67,7 @@ runtime/doc/pi_vimball.txt @cecamp
|
||||
runtime/doc/pi_zip.txt @cecamp
|
||||
runtime/ftplugin/awk.vim @dkearns
|
||||
runtime/ftplugin/bst.vim @tpope
|
||||
runtime/ftplugin/cfg.vim @chrisbra
|
||||
runtime/ftplugin/css.vim @dkearns
|
||||
runtime/ftplugin/cucumber.vim @tpope
|
||||
runtime/ftplugin/eiffel.vim @dkearns
|
||||
@@ -78,9 +81,11 @@ runtime/ftplugin/haml.vim @tpope
|
||||
runtime/ftplugin/hgcommit.vim @k-takata
|
||||
runtime/ftplugin/javascript.vim @dkearns
|
||||
runtime/ftplugin/javascriptreact.vim @dkearns
|
||||
runtime/ftplugin/kconfig.vim @chrisbra
|
||||
runtime/ftplugin/liquid.vim @tpope
|
||||
runtime/ftplugin/markdown.vim @tpope
|
||||
runtime/ftplugin/matlab.vim @cecamp
|
||||
runtime/ftplugin/nroff.vim @a-vrma
|
||||
runtime/ftplugin/nsis.vim @k-takata
|
||||
runtime/ftplugin/pdf.vim @tpope
|
||||
runtime/ftplugin/ruby.vim @tpope @dkearns
|
||||
@@ -89,7 +94,10 @@ runtime/ftplugin/scss.vim @tpope
|
||||
runtime/ftplugin/tmux.vim @ericpruitt
|
||||
runtime/ftplugin/typescript.vim @dkearns
|
||||
runtime/ftplugin/typescriptreact.vim @dkearns
|
||||
runtime/ftplugin/xml.vim @chrisbra
|
||||
runtime/ftplugin/zsh.vim @chrisbra
|
||||
runtime/indent/bst.vim @tpope
|
||||
runtime/syntax/cs.vim @nickspoons
|
||||
runtime/indent/cucumber.vim @tpope
|
||||
runtime/indent/dosbatch.vim @k-takata
|
||||
runtime/indent/eruby.vim @tpope @dkearns
|
||||
@@ -100,7 +108,11 @@ runtime/indent/nsis.vim @k-takata
|
||||
runtime/indent/ruby.vim @AndrewRadev @dkearns
|
||||
runtime/indent/sass.vim @tpope
|
||||
runtime/indent/scss.vim @tpope
|
||||
runtime/indent/sh.vim @chrisbra
|
||||
runtime/indent/xml.vim @chrisbra
|
||||
runtime/indent/zsh.vim @chrisbra
|
||||
runtime/indent/teraterm.vim @k-takata
|
||||
runtime/pack/dist/opt/matchit/ @chrisbra
|
||||
runtime/plugin/getscriptPlugin.vim @cecamp
|
||||
runtime/plugin/logiPat.vim @cecamp
|
||||
runtime/plugin/netrwPlugin.vim @cecamp
|
||||
@@ -112,9 +124,13 @@ runtime/syntax/asm.vim @dkearns
|
||||
runtime/syntax/asmh8300.vim @dkearns
|
||||
runtime/syntax/awk.vim @dkearns
|
||||
runtime/syntax/bst.vim @tpope
|
||||
runtime/syntax/cabalconfig.vim @coot
|
||||
runtime/syntax/cabalproject.vim @coot
|
||||
runtime/syntax/cs.vim @nickspoons
|
||||
runtime/syntax/csh.vim @cecamp
|
||||
runtime/syntax/cucumber.vim @tpope
|
||||
runtime/syntax/dcl.vim @cecamp
|
||||
runtime/syntax/dtd.vim @chrisbra
|
||||
runtime/syntax/elmfilt.vim @cecamp
|
||||
runtime/syntax/eruby.vim @tpope @dkearns
|
||||
runtime/syntax/exports.vim @cecamp
|
||||
@@ -123,7 +139,9 @@ runtime/syntax/gitcommit.vim @tpope
|
||||
runtime/syntax/gitconfig.vim @tpope
|
||||
runtime/syntax/gitrebase.vim @tpope
|
||||
runtime/syntax/haml.vim @tpope
|
||||
runtime/syntax/haskell.vim @coot
|
||||
runtime/syntax/hgcommit.vim @k-takata
|
||||
runtime/syntax/kconfig.vim @chrisbra
|
||||
runtime/syntax/lex.vim @cecamp
|
||||
runtime/syntax/liquid.vim @tpope
|
||||
runtime/syntax/lisp.vim @cecamp
|
||||
@@ -138,12 +156,15 @@ runtime/syntax/nsis.vim @k-takata
|
||||
runtime/syntax/pdf.vim @tpope
|
||||
runtime/syntax/php.vim @TysonAndre
|
||||
runtime/syntax/privoxy.vim @dkearns
|
||||
runtime/syntax/rc.vim @chrisbra
|
||||
runtime/syntax/rpcgen.vim @cecamp
|
||||
runtime/syntax/ruby.vim @dkearns
|
||||
runtime/syntax/sass.vim @tpope
|
||||
runtime/syntax/scss.vim @tpope
|
||||
runtime/syntax/sh.vim @cecamp
|
||||
runtime/syntax/sm.vim @cecamp
|
||||
runtime/syntax/sqloracle.vim @chrisbra
|
||||
runtime/syntax/sshdconfig.vim @Jakuje
|
||||
runtime/syntax/tags.vim @cecamp
|
||||
runtime/syntax/teraterm.vim @k-takata
|
||||
runtime/syntax/tex.vim @cecamp
|
||||
@@ -154,5 +175,8 @@ runtime/syntax/wget.vim @dkearns
|
||||
runtime/syntax/xbl.vim @dkearns
|
||||
runtime/syntax/xmath.vim @cecamp
|
||||
runtime/syntax/xslt.vim @Boobies
|
||||
runtime/syntax/xml.vim @chrisbra
|
||||
runtime/syntax/xxd.vim @cecamp
|
||||
runtime/syntax/yacc.vim @cecamp
|
||||
runtime/syntax/zsh.vim @chrisbra
|
||||
src/po/de.po @chrisbra
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*autocmd.txt* For Vim version 8.2. Last change: 2020 Nov 12
|
||||
*autocmd.txt* For Vim version 8.2. Last change: 2020 Dec 10
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -70,7 +70,8 @@ effects. Be careful not to destroy your text.
|
||||
The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
|
||||
See |autocmd-buflocal|.
|
||||
|
||||
If the `:autocmd` is in Vim9 script then {cmd} will be executed as in Vim9
|
||||
If the `:autocmd` is in Vim9 script (a script that starts with `:vim9script`
|
||||
and in a `:def` function) then {cmd} will be executed as in Vim9
|
||||
script. Thus this depends on where the autocmd is defined, not where it is
|
||||
triggered.
|
||||
|
||||
@@ -305,6 +306,9 @@ Name triggered by ~
|
||||
|VimLeavePre| before exiting Vim, before writing the viminfo file
|
||||
|VimLeave| before exiting Vim, after writing the viminfo file
|
||||
|
||||
|VimSuspend| when suspending Vim
|
||||
|VimResume| when Vim is resumed after being suspended
|
||||
|
||||
Terminal
|
||||
|TerminalOpen| after a terminal buffer was created
|
||||
|TerminalWinOpen| after a terminal buffer was created in a new window
|
||||
@@ -1230,6 +1234,17 @@ VimLeavePre Before exiting Vim, just before writing the
|
||||
VimResized After the Vim window was resized, thus 'lines'
|
||||
and/or 'columns' changed. Not when starting
|
||||
up though.
|
||||
*VimResume*
|
||||
VimResume When the Vim instance is resumed after being
|
||||
suspended and |VimSuspend| was triggered.
|
||||
Useful for triggering |:checktime| and ensure
|
||||
the buffers content did not change while Vim
|
||||
was suspended: >
|
||||
:autocmd VimResume * checktime
|
||||
< *VimSuspend*
|
||||
VimSuspend When the Vim instance is suspended. Only when
|
||||
CTRL-Z was typed inside Vim, not when the
|
||||
SIGSTOP or SIGTSTP signal was sent to Vim.
|
||||
*WinEnter*
|
||||
WinEnter After entering another window. Not done for
|
||||
the first window, when Vim has just started.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 8.2. Last change: 2020 Nov 11
|
||||
*eval.txt* For Vim version 8.2. Last change: 2020 Dec 02
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -5059,9 +5059,9 @@ getbufvar({expr}, {varname} [, {def}]) *getbufvar()*
|
||||
The result is the value of option or local buffer variable
|
||||
{varname} in buffer {expr}. Note that the name without "b:"
|
||||
must be used.
|
||||
When {varname} is empty returns a dictionary with all the
|
||||
When {varname} is empty returns a |Dictionary| with all the
|
||||
buffer-local variables.
|
||||
When {varname} is equal to "&" returns a dictionary with all
|
||||
When {varname} is equal to "&" returns a |Dictionary| with all
|
||||
the buffer-local options.
|
||||
Otherwise, when {varname} starts with "&" returns the value of
|
||||
a buffer-local option.
|
||||
@@ -5533,8 +5533,8 @@ getloclist({nr} [, {what}]) *getloclist()*
|
||||
|location-list-file-window| for more
|
||||
details.
|
||||
|
||||
Returns a Dictionary with default values if there is no location
|
||||
list for the window {nr}.
|
||||
Returns a |Dictionary| with default values if there is no
|
||||
location list for the window {nr}.
|
||||
Returns an empty Dictionary if window {nr} does not exist.
|
||||
|
||||
Examples (See also |getqflist-examples|): >
|
||||
@@ -5647,7 +5647,7 @@ getpos({expr}) Get the position for {expr}. For possible values of {expr}
|
||||
|
||||
|
||||
getqflist([{what}]) *getqflist()*
|
||||
Returns a list with all the current quickfix errors. Each
|
||||
Returns a |List| with all the current quickfix errors. Each
|
||||
list item is a dictionary with these entries:
|
||||
bufnr number of buffer that has the file name, use
|
||||
bufname() to get the name
|
||||
@@ -7153,7 +7153,8 @@ mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()*
|
||||
mapnew({expr1}, {expr2}) *mapnew()*
|
||||
Like |map()| but instead of replacing items in {expr1} a new
|
||||
List or Dictionary is created and returned. {expr1} remains
|
||||
unchanged.
|
||||
unchanged. Items can still be changed by {expr2}, if you
|
||||
don't want that use |deepcopy()| first.
|
||||
|
||||
|
||||
mapset({mode}, {abbr}, {dict}) *mapset()*
|
||||
@@ -7382,7 +7383,7 @@ matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()*
|
||||
|
||||
|
||||
matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()*
|
||||
If {list} is a list of strings, then returns a list with all
|
||||
If {list} is a list of strings, then returns a |List| with all
|
||||
the strings in {list} that fuzzy match {str}. The strings in
|
||||
the returned list are sorted based on the matching score.
|
||||
|
||||
@@ -10660,7 +10661,7 @@ tagfiles() Returns a |List| with the file names used to search for tags
|
||||
|
||||
|
||||
taglist({expr} [, {filename}]) *taglist()*
|
||||
Returns a list of tags matching the regular expression {expr}.
|
||||
Returns a |List| of tags matching the regular expression {expr}.
|
||||
|
||||
If {filename} is passed it is used to prioritize the results
|
||||
in the same way that |:tselect| does. See |tag-priority|.
|
||||
@@ -10752,7 +10753,7 @@ term_ functions are documented here: |terminal-function-details|
|
||||
|
||||
|
||||
terminalprops() *terminalprops()*
|
||||
Returns a dictionary with properties of the terminal that Vim
|
||||
Returns a |Dictionary| with properties of the terminal that Vim
|
||||
detected from the response to |t_RV| request. See
|
||||
|v:termresponse| for the response itself. If |v:termresponse|
|
||||
is empty most values here will be 'u' for unknown.
|
||||
@@ -11159,7 +11160,7 @@ win_execute({id}, {command} [, {silent}]) *win_execute()*
|
||||
GetCommand()->win_execute(winid)
|
||||
|
||||
win_findbuf({bufnr}) *win_findbuf()*
|
||||
Returns a list with |window-ID|s for windows that contain
|
||||
Returns a |List| with |window-ID|s for windows that contain
|
||||
buffer {bufnr}. When there is none the list is empty.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*helphelp.txt* For Vim version 8.2. Last change: 2020 Jul 27
|
||||
*helphelp.txt* For Vim version 8.2. Last change: 2020 Dec 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -161,6 +161,25 @@ files in the directories specified in the 'runtimepath' option.
|
||||
The initial height of the help window can be set with the 'helpheight' option
|
||||
(default 20).
|
||||
|
||||
When the help buffer is created, several local options are set to make sure
|
||||
the help text is displayed as it was intended:
|
||||
'iskeyword' nearly all ASCII chars except ' ', '*', '"' and '|'
|
||||
'foldmethod' "manual"
|
||||
'tabstop' 8
|
||||
'arabic' off
|
||||
'binary' off
|
||||
'buflisted' off
|
||||
'cursorbind' off
|
||||
'diff' off
|
||||
'foldenable' off
|
||||
'list' off
|
||||
'modifiable' off
|
||||
'number' off
|
||||
'relativenumber' off
|
||||
'rightleft' off
|
||||
'scrollbind' off
|
||||
'spell' off
|
||||
|
||||
Jump to specific subjects by using tags. This can be done in two ways:
|
||||
- Use the "CTRL-]" command while standing on the name of a command or option.
|
||||
This only works when the tag is a keyword. "<C-Leftmouse>" and
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*map.txt* For Vim version 8.2. Last change: 2020 Nov 21
|
||||
*map.txt* For Vim version 8.2. Last change: 2020 Dec 10
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -909,7 +909,7 @@ Insert mode to avoid every key with a modifier causing Insert mode to end.
|
||||
1.12 MAPPING AN OPERATOR *:map-operator*
|
||||
|
||||
An operator is used before a {motion} command. To define your own operator
|
||||
you must create mapping that first sets the 'operatorfunc' option and then
|
||||
you must create a mapping that first sets the 'operatorfunc' option and then
|
||||
invoke the |g@| operator. After the user types the {motion} command the
|
||||
specified function will be called.
|
||||
|
||||
@@ -1321,15 +1321,15 @@ last defined. Example: >
|
||||
See |:verbose-cmd| for more information.
|
||||
|
||||
*E174* *E182*
|
||||
:com[mand][!] [{attr}...] {cmd} {rep}
|
||||
:com[mand][!] [{attr}...] {cmd} {repl}
|
||||
Define a user command. The name of the command is
|
||||
{cmd} and its replacement text is {rep}. The command's
|
||||
attributes (see below) are {attr}. If the command
|
||||
already exists, an error is reported, unless a ! is
|
||||
specified, in which case the command is redefined.
|
||||
There is one exception: When sourcing a script again,
|
||||
a command that was previously defined in that script
|
||||
will be silently replaced.
|
||||
{cmd} and its replacement text is {repl}. The
|
||||
command's attributes (see below) are {attr}. If the
|
||||
command already exists, an error is reported, unless a
|
||||
! is specified, in which case the command is
|
||||
redefined. There is one exception: When sourcing a
|
||||
script again, a command that was previously defined in
|
||||
that script will be silently replaced.
|
||||
|
||||
|
||||
:delc[ommand] {cmd} *:delc* *:delcommand* *E184*
|
||||
@@ -1539,11 +1539,11 @@ feature. Use the full name for new scripts.
|
||||
|
||||
Replacement text ~
|
||||
|
||||
The replacement text for a user defined command is scanned for special escape
|
||||
sequences, using <...> notation. Escape sequences are replaced with values
|
||||
from the entered command line, and all other text is copied unchanged. The
|
||||
resulting string is executed as an Ex command. To avoid the replacement use
|
||||
<lt> in place of the initial <. Thus to include "<bang>" literally use
|
||||
The replacement text {repl} for a user defined command is scanned for special
|
||||
escape sequences, using <...> notation. Escape sequences are replaced with
|
||||
values from the entered command line, and all other text is copied unchanged.
|
||||
The resulting string is executed as an Ex command. To avoid the replacement
|
||||
use <lt> in place of the initial <. Thus to include "<bang>" literally use
|
||||
"<lt>bang>".
|
||||
|
||||
The valid escape sequences are
|
||||
@@ -1669,6 +1669,11 @@ errors and the "update" command to write modified buffers): >
|
||||
This will invoke: >
|
||||
:call Allargs("%s/foo/bar/ge|update")
|
||||
<
|
||||
If the command is defined in Vim9 script (a script that starts with
|
||||
`:vim9script` and in a `:def` function) then {repl} will be executed as in Vim9
|
||||
script. Thus this depends on where the command is defined, not where it is
|
||||
used.
|
||||
|
||||
When defining a user command in a script, it will be able to call functions
|
||||
local to the script and use mappings local to the script. When the user
|
||||
invokes the user command, it will run in the context of the script it was
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*pattern.txt* For Vim version 8.2. Last change: 2020 Sep 01
|
||||
*pattern.txt* For Vim version 8.2. Last change: 2020 Dec 06
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -361,8 +361,8 @@ For starters, read chapter 27 of the user manual |usr_27.txt|.
|
||||
*/atom*
|
||||
5. An atom can be one of a long list of items. Many atoms match one character
|
||||
in the text. It is often an ordinary character or a character class.
|
||||
Braces can be used to make a pattern into an atom. The "\z(\)" construct
|
||||
is only for syntax highlighting.
|
||||
Parentheses can be used to make a pattern into an atom. The "\z(\)"
|
||||
construct is only for syntax highlighting.
|
||||
|
||||
atom ::= ordinary-atom |/ordinary-atom|
|
||||
or \( pattern \) |/\(|
|
||||
@@ -676,7 +676,7 @@ overview.
|
||||
|
||||
Note that using "\&" works the same as using "\@=": "foo\&.." is the
|
||||
same as "\(foo\)\@=..". But using "\&" is easier, you don't need the
|
||||
braces.
|
||||
parentheses.
|
||||
|
||||
|
||||
*/\@!*
|
||||
@@ -1069,8 +1069,8 @@ x A single character, with no special meaning, matches itself
|
||||
|
||||
[] (with 'nomagic': \[]) */[]* */\[]* */\_[]* */collection*
|
||||
\_[]
|
||||
A collection. This is a sequence of characters enclosed in brackets.
|
||||
It matches any single character in the collection.
|
||||
A collection. This is a sequence of characters enclosed in square
|
||||
brackets. It matches any single character in the collection.
|
||||
Example matches ~
|
||||
[xyz] any 'x', 'y' or 'z'
|
||||
[a-zA-Z]$ any alphabetic character at the end of a line
|
||||
@@ -1129,11 +1129,12 @@ x A single character, with no special meaning, matches itself
|
||||
*[:ident:]* [:ident:] identifier character (same as "\i")
|
||||
*[:keyword:]* [:keyword:] keyword character (same as "\k")
|
||||
*[:fname:]* [:fname:] file name character (same as "\f")
|
||||
The brackets in character class expressions are additional to the
|
||||
brackets delimiting a collection. For example, the following is a
|
||||
plausible pattern for a UNIX filename: "[-./[:alnum:]_~]\+" That is,
|
||||
a list of at least one character, each of which is either '-', '.',
|
||||
'/', alphabetic, numeric, '_' or '~'.
|
||||
The square brackets in character class expressions are additional to
|
||||
the square brackets delimiting a collection. For example, the
|
||||
following is a plausible pattern for a UNIX filename:
|
||||
"[-./[:alnum:]_~]\+". That is, a list of at least one character,
|
||||
each of which is either '-', '.', '/', alphabetic, numeric, '_' or
|
||||
'~'.
|
||||
These items only work for 8-bit characters, except [:lower:] and
|
||||
[:upper:] also work for multibyte characters when using the new
|
||||
regexp engine. See |two-engines|. In the future these items may
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*syntax.txt* For Vim version 8.2. Last change: 2020 Nov 22
|
||||
*syntax.txt* For Vim version 8.2. Last change: 2020 Dec 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -3183,6 +3183,7 @@ redrawing can become slow.
|
||||
|
||||
|
||||
TEX *tex.vim* *ft-tex-syntax* *latex-syntax*
|
||||
*syntax-tex* *syntax-latex*
|
||||
|
||||
Tex Contents~
|
||||
Tex: Want Syntax Folding? |tex-folding|
|
||||
@@ -3199,6 +3200,7 @@ TEX *tex.vim* *ft-tex-syntax* *latex-syntax*
|
||||
Tex: Selective Conceal Mode |g:tex_conceal|
|
||||
Tex: Controlling iskeyword |g:tex_isk|
|
||||
Tex: Fine Subscript and Superscript Control |tex-supersub|
|
||||
Tex: Match Check Control |tex-matchcheck|
|
||||
|
||||
*tex-folding* *g:tex_fold_enabled*
|
||||
Tex: Want Syntax Folding? ~
|
||||
@@ -3422,6 +3424,22 @@ syntax highlighting script handles this with the following logic:
|
||||
< in ~/.vim/ftplugin/tex/tex.vim in order to avoid having inscrutable
|
||||
utf-8 glyphs appear.
|
||||
|
||||
*tex-matchcheck* *g:tex_matchcheck*
|
||||
Tex: Match Check Control~
|
||||
|
||||
Sometimes one actually wants mismatched parentheses, square braces,
|
||||
and or curly braces; for example, \text{(1,10] is a range from but
|
||||
not including 1 to and including 10}. This wish, of course, conflicts
|
||||
with the desire to provide delimiter mismatch detection. To
|
||||
accommodate these conflicting goals, syntax/tex.vim provides >
|
||||
g:tex_matchcheck = '[({[]'
|
||||
< which is shown along with its default setting. So, if one doesn't
|
||||
want [] and () to be checked for mismatches, try using >
|
||||
let g:tex_matchcheck= '[{}]'
|
||||
< If you don't want matching to occur inside bold and italicized
|
||||
regions, >
|
||||
let g:tex_excludematcher= 1
|
||||
< will prevent the texMatcher group from being included in those regions.
|
||||
|
||||
TF *tf.vim* *ft-tf-syntax*
|
||||
|
||||
|
||||
@@ -6255,6 +6255,7 @@ exepath() eval.txt /*exepath()*
|
||||
exim starting.txt /*exim*
|
||||
exists() eval.txt /*exists()*
|
||||
exiting starting.txt /*exiting*
|
||||
exiting-variable eval.txt /*exiting-variable*
|
||||
exp() eval.txt /*exp()*
|
||||
expand() eval.txt /*expand()*
|
||||
expand-env options.txt /*expand-env*
|
||||
@@ -6862,6 +6863,7 @@ g:tex_fast syntax.txt /*g:tex_fast*
|
||||
g:tex_flavor filetype.txt /*g:tex_flavor*
|
||||
g:tex_fold_enabled syntax.txt /*g:tex_fold_enabled*
|
||||
g:tex_isk syntax.txt /*g:tex_isk*
|
||||
g:tex_matchcheck syntax.txt /*g:tex_matchcheck*
|
||||
g:tex_no_error syntax.txt /*g:tex_no_error*
|
||||
g:tex_nospell syntax.txt /*g:tex_nospell*
|
||||
g:tex_stylish syntax.txt /*g:tex_stylish*
|
||||
@@ -9174,8 +9176,10 @@ synstack() eval.txt /*synstack()*
|
||||
syntax syntax.txt /*syntax*
|
||||
syntax-functions usr_41.txt /*syntax-functions*
|
||||
syntax-highlighting syntax.txt /*syntax-highlighting*
|
||||
syntax-latex syntax.txt /*syntax-latex*
|
||||
syntax-loading syntax.txt /*syntax-loading*
|
||||
syntax-printing usr_06.txt /*syntax-printing*
|
||||
syntax-tex syntax.txt /*syntax-tex*
|
||||
syntax.txt syntax.txt /*syntax.txt*
|
||||
syntax_cmd syntax.txt /*syntax_cmd*
|
||||
sys-file-list help.txt /*sys-file-list*
|
||||
@@ -9610,6 +9614,7 @@ tex-cole syntax.txt /*tex-cole*
|
||||
tex-conceal syntax.txt /*tex-conceal*
|
||||
tex-error syntax.txt /*tex-error*
|
||||
tex-folding syntax.txt /*tex-folding*
|
||||
tex-matchcheck syntax.txt /*tex-matchcheck*
|
||||
tex-math syntax.txt /*tex-math*
|
||||
tex-morecommands syntax.txt /*tex-morecommands*
|
||||
tex-nospell syntax.txt /*tex-nospell*
|
||||
@@ -9787,6 +9792,7 @@ v:errmsg eval.txt /*v:errmsg*
|
||||
v:errors eval.txt /*v:errors*
|
||||
v:event eval.txt /*v:event*
|
||||
v:exception eval.txt /*v:exception*
|
||||
v:exiting eval.txt /*v:exiting*
|
||||
v:false eval.txt /*v:false*
|
||||
v:fcs_choice eval.txt /*v:fcs_choice*
|
||||
v:fcs_reason eval.txt /*v:fcs_reason*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 8.2. Last change: 2020 Nov 28
|
||||
*todo.txt* For Vim version 8.2. Last change: 2020 Dec 10
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -38,34 +38,16 @@ browser use: https://github.com/vim/vim/issues/1234
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
Vim9 - Change
|
||||
- Drop support for #{} early December. Close #7310
|
||||
-> Does it work to recognize lambda?
|
||||
{x: int -> x + 5}
|
||||
var int = 5
|
||||
{x: int, y: int}
|
||||
Vim9 - Making everything work:
|
||||
- Compile: for [key, value] in items(map): Also support @r, $VAR, etc.
|
||||
- Make map() give an error if the resulting type of the first argument is
|
||||
wrong. Only works if the type is known? Is this slow (need to go over all
|
||||
items)?
|
||||
- Run the same tests in :def and Vim9 script, like in Test_expr7_not()
|
||||
- need to check type when a declaration specifies a type: #6507
|
||||
let nr: number = 'asdf'
|
||||
- Check many more builtin function arguments at compile time.
|
||||
- Make sure that in vim9script a function call without namespace only finds
|
||||
the script-local function, not a global one.
|
||||
- Make sure that where a callback is expected a function can be used (without
|
||||
quotes). E.g. sort() and map(). Also at the script level.
|
||||
- ":put" with ISN_PUT does not handle range correctly, e.g. ":$-2put".
|
||||
Add command to parse range at runtime?
|
||||
- When defining an :autocmd or :command, how to specify using Vim9 syntax?
|
||||
- always do this when defined in a Vim9 script
|
||||
- add some command modifier.
|
||||
- For an :autocmd and :command argument, if a following line starts with "|"
|
||||
append it. It's like line continuation. (#6702)
|
||||
Vim9 - Make everything work:
|
||||
- For an :autocmd and :command argument defined in Vim9 script, if a following
|
||||
line starts with "|" append it. It's like line continuation. (#6702)
|
||||
- The syntax of a range list[a:b] is ambiguous, is this one "a:b" variable or
|
||||
a range from "a" to "b"? To avoid confusion, require white space before
|
||||
(and after) the colon? #7409
|
||||
- Implement "export {one, two three}".
|
||||
- ISN_CHECKTYPE could use check_argtype()
|
||||
- Using a script variable inside a :def function doesn't work if the variable
|
||||
is inside a block, see Test_nested_function(). Should it work?
|
||||
- give error for variable name:
|
||||
let p = function('NoSuchFunc')
|
||||
- If a :def function is called with a function reference, compile it to get
|
||||
@@ -78,7 +60,14 @@ Vim9 - Making everything work:
|
||||
- Does this work already: can use func as reference:
|
||||
def SomeFunc() ...
|
||||
map(list, SomeFunc)
|
||||
- For builtin functions using tv_get_string*() use check_for_string() to be
|
||||
more strict about the argument type.
|
||||
- Support passing v:none to use the default argument value. (#6504)
|
||||
- Make map() give an error if the resulting type of the first argument is
|
||||
wrong. Only works if the type is known? Is this slow (need to go over all
|
||||
items)?
|
||||
- Run the same tests in :def and Vim9 script, like in Test_expr7_not()
|
||||
- Check many more builtin function arguments at compile time.
|
||||
- make 0 == 'string' fail on the script level, like inside :def.
|
||||
- Check that when using a user function name without prefix, it does not find
|
||||
a global function. Prefixing g: is required.
|
||||
@@ -107,9 +96,11 @@ Vim9 - Making everything work:
|
||||
- expandcmd() with `=expr` in filename uses legacy expression.
|
||||
- eval_expr() in ex_cexpr()
|
||||
- eval_expr() call in dbg_parsearg() and debuggy_find()
|
||||
New syntax and functionality:
|
||||
Improve error checking:
|
||||
- "echo Func()" is an error if Func() does not return anything.
|
||||
Before launch:
|
||||
- Add all the error numbers in a good place in documentation.
|
||||
- In the generic eval docs, point out the Vim9 syntax where it differs.
|
||||
Also:
|
||||
- For range: make table of first ASCII character with flag to quickly check if
|
||||
it can be a Vim9 command. E.g. "+" can, but "." can't.
|
||||
@@ -184,6 +175,8 @@ Text properties:
|
||||
- "cc" does not call inserted_bytes(). (Axel Forsman, #5763)
|
||||
- Combining text property with 'cursorline' does not always work (Billie
|
||||
Cleek, #5533)
|
||||
- Should we let the textprop highlight overrule other (e.g. diff) highlight if
|
||||
the priority is above a certain value? (#7392)
|
||||
- See remarks at top of src/textprop.c
|
||||
|
||||
'incsearch' with :s:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*undo.txt* For Vim version 8.2. Last change: 2020 Oct 18
|
||||
*undo.txt* For Vim version 8.2. Last change: 2020 Nov 30
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -65,9 +65,9 @@ with the redo command. If you make a new change after the undo command,
|
||||
the redo will not be possible anymore.
|
||||
|
||||
'u' included, the Vi-compatible way:
|
||||
The undo command undoes the previous change, and also the previous undo command.
|
||||
The redo command repeats the previous undo command. It does NOT repeat a
|
||||
change command, use "." for that.
|
||||
The undo command undoes the previous change, and also the previous undo
|
||||
command. The redo command repeats the previous undo command. It does NOT
|
||||
repeat a change command, use "." for that.
|
||||
|
||||
Examples Vim way Vi-compatible way ~
|
||||
"uu" two times undo no-op
|
||||
@@ -103,7 +103,7 @@ change again. But you can do something like this: >
|
||||
|
||||
:undojoin | delete
|
||||
|
||||
After this an "u" command will undo the delete command and the previous
|
||||
After this a "u" command will undo the delete command and the previous
|
||||
change.
|
||||
|
||||
To do the opposite, break a change into two undo blocks, in Insert mode use
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2020 Dec 04
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2020 Dec 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -123,8 +123,8 @@ often 10x to 100x times.
|
||||
Many errors are already found when compiling, before the function is executed.
|
||||
The syntax is strict, to enforce code that is easy to read and understand.
|
||||
|
||||
Compilation is done when:
|
||||
- the function is first called
|
||||
Compilation is done when either of these is encountered:
|
||||
- the first time the function is called
|
||||
- when the `:defcompile` command is encountered in the script where the
|
||||
function was defined
|
||||
- `:disassemble` is used for the function.
|
||||
@@ -132,8 +132,9 @@ Compilation is done when:
|
||||
reference
|
||||
|
||||
`:def` has no options like `:function` does: "range", "abort", "dict" or
|
||||
"closure". A `:def` function always aborts on an error, does not get a range
|
||||
passed and cannot be a "dict" function.
|
||||
"closure". A `:def` function always aborts on an error (unless `:silent!` was
|
||||
used for the command or inside a `:try` block), does not get a range passed
|
||||
and cannot be a "dict" function.
|
||||
|
||||
The argument types and return type need to be specified. The "any" type can
|
||||
be used, type checking will then be done at runtime, like with legacy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2020 Nov 22
|
||||
" Last Change: 2020 Dec 07
|
||||
|
||||
" Listen very carefully, I will say this only once
|
||||
if exists("did_load_filetypes")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"
|
||||
" Author: Bram Moolenaar
|
||||
" Copyright: Vim license applies, see ":help license"
|
||||
" Last Change: 2020 Oct 28
|
||||
" Last Change: 2020 Dec 07
|
||||
"
|
||||
" WORK IN PROGRESS - Only the basics work
|
||||
" Note: On MS-Windows you need a recent version of gdb. The one included with
|
||||
@@ -726,8 +726,12 @@ func s:DeleteCommands()
|
||||
delcommand Source
|
||||
delcommand Winbar
|
||||
|
||||
if exists('s:k_map_saved') && !empty(s:k_map_saved)
|
||||
call mapset('n', 0, s:k_map_saved)
|
||||
if exists('s:k_map_saved')
|
||||
if empty(s:k_map_saved)
|
||||
nunmap K
|
||||
else
|
||||
call mapset('n', 0, s:k_map_saved)
|
||||
endif
|
||||
unlet s:k_map_saved
|
||||
endif
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
" Language: aidl (Android Interface Definition Language)
|
||||
" https://developer.android.com/guide/components/aidl
|
||||
" Maintainer: Dominique Pelle <dominique.pelle@tomtom.com>
|
||||
" LastChange: 2020/07/25
|
||||
" LastChange: 2020/12/03
|
||||
|
||||
" Quit when a syntax file was already loaded.
|
||||
if exists("b:current_syntax")
|
||||
@@ -12,7 +12,7 @@ endif
|
||||
source <sfile>:p:h/java.vim
|
||||
|
||||
syn keyword aidlParamDir in out inout
|
||||
syn keyword aidlKeyword oneway parcelable
|
||||
syn keyword aidlKeyword const oneway parcelable
|
||||
|
||||
" Needed for the 'in', 'out', 'inout' keywords to be highlighted.
|
||||
syn cluster javaTop add=aidlParamDir
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
" Language: Diff (context or unified)
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Translations by Jakson Alves de Aquino.
|
||||
" Last Change: 2016 Apr 02
|
||||
" Last Change: 2020 Dec 07
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@@ -346,9 +346,11 @@ syn match diffLine "^---$"
|
||||
syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*"
|
||||
|
||||
syn match diffFile "^diff\>.*"
|
||||
syn match diffFile "^+++ .*"
|
||||
syn match diffFile "^Index: .*"
|
||||
syn match diffFile "^==== .*"
|
||||
" Old style diff uses *** for old and --- for new.
|
||||
" Unified diff uses --- for old and +++ for new; names are wrong but it works.
|
||||
syn match diffOldFile "^+++ .*"
|
||||
syn match diffOldFile "^\*\*\* .*"
|
||||
syn match diffNewFile "^--- .*"
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ endif
|
||||
|
||||
" Use a compiled Vim9 function for speed
|
||||
def DoIt()
|
||||
let lnum = 1
|
||||
var lnum = 1
|
||||
for c in range(0x100, 0x1ffff)
|
||||
let cs = nr2char(c)
|
||||
var cs = nr2char(c)
|
||||
if charclass(cs) == 3
|
||||
setline(lnum, '|' .. cs .. '| ' .. strwidth(cs))
|
||||
lnum += 1
|
||||
|
||||
@@ -906,9 +906,9 @@ NOTE : Si vous voulez ignorer la casse uniquement pour une recherche, utilisez
|
||||
soit appuy<75>.
|
||||
|
||||
6. Taper ":set xxx" active l'option "xxx". Quelques options sont :
|
||||
'ic' 'ingnorecase' pour ignorer la casse lors des recherches.
|
||||
'is' 'incsearch' pour montrer les appariements partiels.
|
||||
'hls' 'hlsearch' pour mettre en surbrillance les appariements.
|
||||
'ic' 'ignorecase' pour ignorer la casse lors des recherches.
|
||||
'is' 'incsearch' pour montrer les appariements partiels.
|
||||
'hls' 'hlsearch' pour mettre en surbrillance les appariements.
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -906,9 +906,9 @@ NOTE : Si vous voulez ignorer la casse uniquement pour une recherche, utilisez
|
||||
soit appuyé.
|
||||
|
||||
6. Taper ":set xxx" active l'option "xxx". Quelques options sont :
|
||||
'ic' 'ingnorecase' pour ignorer la casse lors des recherches.
|
||||
'is' 'incsearch' pour montrer les appariements partiels.
|
||||
'hls' 'hlsearch' pour mettre en surbrillance les appariements.
|
||||
'ic' 'ignorecase' pour ignorer la casse lors des recherches.
|
||||
'is' 'incsearch' pour montrer les appariements partiels.
|
||||
'hls' 'hlsearch' pour mettre en surbrillance les appariements.
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -131,14 +131,6 @@ vim_cv_toupper_broken:
|
||||
Whether the "toupper" C library function works correctly. Set to "yes"
|
||||
if you know it's broken, otherwise set to "no".
|
||||
|
||||
vim_cv_tty_group:
|
||||
The default group of pseudo terminals. Either set to the numeric value
|
||||
of your tty group or to "world" if they are world accessible.
|
||||
|
||||
vim_cv_tty_mode:
|
||||
The default mode of pseudo terminals if they are not world accessible.
|
||||
Most probably the value "0620".
|
||||
|
||||
|
||||
4. EXAMPLE:
|
||||
===========
|
||||
@@ -153,7 +145,6 @@ vim_cv_stat_ignores_slash=yes \
|
||||
vim_cv_tgetent=zero \
|
||||
vim_cv_terminfo=yes \
|
||||
vim_cv_toupper_broken=no \
|
||||
vim_cv_tty_group=world \
|
||||
./configure \
|
||||
--build=i586-linux \
|
||||
--host=armeb-xscale-linux-gnu \
|
||||
|
||||
@@ -191,6 +191,8 @@ static struct event_name
|
||||
{"WinLeave", EVENT_WINLEAVE},
|
||||
{"VimResized", EVENT_VIMRESIZED},
|
||||
{"TextYankPost", EVENT_TEXTYANKPOST},
|
||||
{"VimSuspend", EVENT_VIMSUSPEND},
|
||||
{"VimResume", EVENT_VIMRESUME},
|
||||
{NULL, (event_T)0}
|
||||
};
|
||||
|
||||
|
||||
10
src/errors.h
10
src/errors.h
@@ -61,7 +61,7 @@ EXTERN char e_argument_nr_type_mismatch_expected_str_but_got_str[]
|
||||
INIT(= N_("E1013: Argument %d: type mismatch, expected %s but got %s"));
|
||||
EXTERN char e_invalid_key_str[]
|
||||
INIT(= N_("E1014: Invalid key: %s"));
|
||||
EXTERN char e_name_expected[]
|
||||
EXTERN char e_name_expected_str[]
|
||||
INIT(= N_("E1015: Name expected: %s"));
|
||||
EXTERN char e_cannot_declare_a_scope_variable[]
|
||||
INIT(= N_("E1016: Cannot declare a %s variable: %s"));
|
||||
@@ -313,3 +313,11 @@ EXTERN char e_for_argument_must_be_sequence_of_lists[]
|
||||
INIT(= N_("E1140: For argument must be a sequence of lists"));
|
||||
EXTERN char e_indexable_type_required[]
|
||||
INIT(= N_("E1141: Indexable type required"));
|
||||
EXTERN char e_non_empty_string_required[]
|
||||
INIT(= N_("E1142: Non-empty string required"));
|
||||
EXTERN char e_empty_expression_str[]
|
||||
INIT(= N_("E1143: Empty expression: \"%s\""));
|
||||
EXTERN char e_command_not_followed_by_white_space_str[]
|
||||
INIT(= N_("E1144: Command is not followed by white space: %s"));
|
||||
EXTERN char e_missing_heredoc_end_marker_str[]
|
||||
INIT(= N_("E1145: Missing heredoc end marker: %s"));
|
||||
|
||||
@@ -2721,19 +2721,23 @@ get_script_local_ht(void)
|
||||
|
||||
/*
|
||||
* Look for "name[len]" in script-local variables.
|
||||
* Return a non-NULL pointer when found, NULL when not found.
|
||||
* Return OK when found, FAIL when not found.
|
||||
*/
|
||||
void *
|
||||
lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy UNUSED)
|
||||
int
|
||||
lookup_scriptvar(
|
||||
char_u *name,
|
||||
size_t len,
|
||||
void *lvar UNUSED,
|
||||
cctx_T *dummy UNUSED)
|
||||
{
|
||||
hashtab_T *ht = get_script_local_ht();
|
||||
char_u buffer[30];
|
||||
char_u *p;
|
||||
void *res;
|
||||
int res;
|
||||
hashitem_T *hi;
|
||||
|
||||
if (ht == NULL)
|
||||
return NULL;
|
||||
return FAIL;
|
||||
if (len < sizeof(buffer) - 1)
|
||||
{
|
||||
// avoid an alloc/free for short names
|
||||
@@ -2744,20 +2748,19 @@ lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy UNUSED)
|
||||
{
|
||||
p = vim_strnsave(name, len);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
hi = hash_find(ht, p);
|
||||
res = HASHITEM_EMPTY(hi) ? NULL : hi;
|
||||
res = HASHITEM_EMPTY(hi) ? FAIL : OK;
|
||||
|
||||
// if not script-local, then perhaps imported
|
||||
if (res == NULL && find_imported(p, 0, NULL) != NULL)
|
||||
res = p;
|
||||
if (res == FAIL && find_imported(p, 0, NULL) != NULL)
|
||||
res = OK;
|
||||
|
||||
if (p != buffer)
|
||||
vim_free(p);
|
||||
// Don't return "buffer", gcc complains.
|
||||
return res == NULL ? NULL : IObuff;
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#define EX_LOCK_OK 0x1000000 // command can be executed when textlock is
|
||||
// set; when missing disallows editing another
|
||||
// buffer when curbuf_lock is set
|
||||
#define EX_NONWHITE_OK 0x2000000 // command can be followed by non-white
|
||||
|
||||
#define EX_FILES (EX_XFILE | EX_EXTRA) // multiple extra files allowed
|
||||
#define EX_FILE1 (EX_FILES | EX_NOSPC) // 1 file, defaults to current file
|
||||
@@ -632,7 +633,7 @@ EXCMD(CMD_function, "function", ex_function,
|
||||
EX_EXTRA|EX_BANG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_global, "global", ex_global,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_EXTRA|EX_DFLALL|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_EXTRA|EX_DFLALL|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK|EX_NONWHITE_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_goto, "goto", ex_goto,
|
||||
EX_RANGE|EX_COUNT|EX_TRLBAR|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
@@ -1277,7 +1278,7 @@ EXCMD(CMD_rviminfo, "rviminfo", ex_viminfo,
|
||||
EX_BANG|EX_FILE1|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_substitute, "substitute", ex_substitute,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_NONWHITE_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_sNext, "sNext", ex_previous,
|
||||
EX_EXTRA|EX_RANGE|EX_COUNT|EX_BANG|EX_CMDARG|EX_ARGOPT|EX_TRLBAR,
|
||||
@@ -1652,7 +1653,7 @@ EXCMD(CMD_update, "update", ex_update,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_FILE1|EX_ARGOPT|EX_DFLALL|EX_TRLBAR,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_vglobal, "vglobal", ex_global,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_DFLALL|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_DFLALL|EX_CMDWIN|EX_LOCK_OK|EX_NONWHITE_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_var, "var", ex_var,
|
||||
EX_EXTRA|EX_NOTRLCOM|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK,
|
||||
@@ -1792,16 +1793,16 @@ EXCMD(CMD_z, "z", ex_z,
|
||||
|
||||
// commands that don't start with a letter
|
||||
EXCMD(CMD_bang, "!", ex_bang,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_FILES|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_BANG|EX_FILES|EX_CMDWIN|EX_LOCK_OK|EX_NONWHITE_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_pound, "#", ex_print,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_COUNT|EX_FLAGS|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_and, "&", ex_substitute,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY|EX_NONWHITE_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_star, "*", ex_at,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_NONWHITE_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_lshift, "<", ex_operators,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_COUNT|EX_FLAGS|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY,
|
||||
@@ -1813,7 +1814,7 @@ EXCMD(CMD_rshift, ">", ex_operators,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_COUNT|EX_FLAGS|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_at, "@", ex_at,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_NONWHITE_OK,
|
||||
ADDR_LINES),
|
||||
EXCMD(CMD_block, "{{{{{{{{", ex_block, // not found normally
|
||||
0,
|
||||
@@ -1822,7 +1823,7 @@ EXCMD(CMD_endblock, "}", ex_endblock,
|
||||
EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_tilde, "~", ex_substitute,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY,
|
||||
EX_RANGE|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_MODIFY|EX_NONWHITE_OK,
|
||||
ADDR_LINES),
|
||||
|
||||
// commands that start with an uppercase letter
|
||||
|
||||
@@ -1683,7 +1683,7 @@ comment_start(char_u *p, int starts_with_colon UNUSED)
|
||||
{
|
||||
#ifdef FEAT_EVAL
|
||||
if (in_vim9script())
|
||||
return p[0] == '#' && p[1] != '{' && !starts_with_colon;
|
||||
return p[0] == '#' && !starts_with_colon;
|
||||
#endif
|
||||
return *p == '"';
|
||||
}
|
||||
@@ -3271,7 +3271,7 @@ skip_option_env_lead(char_u *start)
|
||||
find_ex_command(
|
||||
exarg_T *eap,
|
||||
int *full UNUSED,
|
||||
void *(*lookup)(char_u *, size_t, cctx_T *) UNUSED,
|
||||
int (*lookup)(char_u *, size_t, void *, cctx_T *) UNUSED,
|
||||
cctx_T *cctx UNUSED)
|
||||
{
|
||||
int len;
|
||||
@@ -3387,7 +3387,7 @@ find_ex_command(
|
||||
|| *eap->cmd == '&'
|
||||
|| *eap->cmd == '$'
|
||||
|| *eap->cmd == '@'
|
||||
|| lookup(eap->cmd, p - eap->cmd, cctx) != NULL)
|
||||
|| lookup(eap->cmd, p - eap->cmd, NULL, cctx) == OK)
|
||||
{
|
||||
eap->cmdidx = CMD_var;
|
||||
return eap->cmd;
|
||||
@@ -3528,6 +3528,14 @@ find_ex_command(
|
||||
if (eap->cmdidx == CMD_final && p - eap->cmd == 4)
|
||||
eap->cmdidx = CMD_finally;
|
||||
|
||||
if (eap->cmdidx != CMD_SIZE && in_vim9script()
|
||||
&& !IS_WHITE_OR_NUL(*p) && !ends_excmd(*p) && *p != '!'
|
||||
&& (cmdnames[eap->cmdidx].cmd_argt & EX_NONWHITE_OK) == 0)
|
||||
{
|
||||
semsg(_(e_command_not_followed_by_white_space_str), eap->cmd);
|
||||
eap->cmdidx = CMD_SIZE;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -4780,7 +4788,6 @@ separate_nextcmd(exarg_T *eap)
|
||||
|| (*p == '#'
|
||||
&& in_vim9script()
|
||||
&& !(eap->argt & EX_NOTRLCOM)
|
||||
&& p[1] != '{'
|
||||
&& p > eap->cmd && VIM_ISWHITE(p[-1]))
|
||||
#endif
|
||||
|| *p == '|' || *p == '\n')
|
||||
@@ -5115,7 +5122,7 @@ ex_blast(exarg_T *eap)
|
||||
|
||||
/*
|
||||
* Check if "c" ends an Ex command.
|
||||
* In Vim9 script does not check for white space before # or #{.
|
||||
* In Vim9 script does not check for white space before #.
|
||||
*/
|
||||
int
|
||||
ends_excmd(int c)
|
||||
@@ -5864,6 +5871,7 @@ ex_stop(exarg_T *eap)
|
||||
{
|
||||
if (!eap->forceit)
|
||||
autowrite_all();
|
||||
apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, FALSE, NULL);
|
||||
windgoto((int)Rows - 1, 0);
|
||||
out_char('\n');
|
||||
out_flush();
|
||||
@@ -5881,6 +5889,7 @@ ex_stop(exarg_T *eap)
|
||||
scroll_start(); // scroll screen before redrawing
|
||||
redraw_later_clear();
|
||||
shell_resized(); // may have resized window
|
||||
apply_autocmds(EVENT_VIMRESUME, NULL, NULL, FALSE, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -876,7 +876,7 @@ f_exepath(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
char_u *p = NULL;
|
||||
|
||||
if (in_vim9script() && check_for_string(&argvars[0]) == FAIL)
|
||||
if (in_vim9script() && check_for_nonempty_string(&argvars[0]) == FAIL)
|
||||
return;
|
||||
(void)mch_can_exe(tv_get_string(&argvars[0]), &p, TRUE);
|
||||
rettv->v_type = VAR_STRING;
|
||||
@@ -942,7 +942,7 @@ findfilendir(
|
||||
|
||||
rettv->vval.v_string = NULL;
|
||||
rettv->v_type = VAR_STRING;
|
||||
if (in_vim9script() && check_for_string(&argvars[0]) == FAIL)
|
||||
if (in_vim9script() && check_for_nonempty_string(&argvars[0]) == FAIL)
|
||||
return;
|
||||
|
||||
#ifdef FEAT_SEARCHPATH
|
||||
@@ -1019,7 +1019,7 @@ f_fnamemodify(typval_T *argvars, typval_T *rettv)
|
||||
char_u *fname;
|
||||
char_u *mods;
|
||||
int usedlen = 0;
|
||||
int len;
|
||||
int len = 0;
|
||||
char_u *fbuf = NULL;
|
||||
char_u buf[NUMBUFLEN];
|
||||
|
||||
@@ -1028,12 +1028,13 @@ f_fnamemodify(typval_T *argvars, typval_T *rettv)
|
||||
return;
|
||||
fname = tv_get_string_chk(&argvars[0]);
|
||||
mods = tv_get_string_buf_chk(&argvars[1], buf);
|
||||
if (fname == NULL || mods == NULL)
|
||||
if (mods == NULL || fname == NULL)
|
||||
fname = NULL;
|
||||
else
|
||||
{
|
||||
len = (int)STRLEN(fname);
|
||||
(void)modify_fname(mods, FALSE, &usedlen, &fname, &fbuf, &len);
|
||||
if (mods != NULL && *mods != NUL)
|
||||
(void)modify_fname(mods, FALSE, &usedlen, &fname, &fbuf, &len);
|
||||
}
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
|
||||
@@ -512,6 +512,10 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if RUBY_VERSION >= 26
|
||||
void rb_ary_detransient_stub(VALUE x);
|
||||
# endif
|
||||
|
||||
# if (RUBY_VERSION >= 19) && !defined(PROTO)
|
||||
# if RUBY_VERSION >= 22
|
||||
long
|
||||
|
||||
@@ -1298,6 +1298,7 @@ ins_compl_files(
|
||||
fp = mch_fopen((char *)files[i], "r"); // open dictionary file
|
||||
if (flags != DICT_EXACT)
|
||||
{
|
||||
msg_hist_off = TRUE; // reset in msg_trunc_attr()
|
||||
vim_snprintf((char *)IObuff, IOSIZE,
|
||||
_("Scanning dictionary: %s"), (char *)files[i]);
|
||||
(void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R));
|
||||
@@ -2778,6 +2779,7 @@ ins_compl_get_exp(pos_T *ini)
|
||||
dict = ins_buf->b_fname;
|
||||
dict_f = DICT_EXACT;
|
||||
}
|
||||
msg_hist_off = TRUE; // reset in msg_trunc_attr()
|
||||
vim_snprintf((char *)IObuff, IOSIZE, _("Scanning: %s"),
|
||||
ins_buf->b_fname == NULL
|
||||
? buf_spname(ins_buf)
|
||||
@@ -2812,6 +2814,7 @@ ins_compl_get_exp(pos_T *ini)
|
||||
#endif
|
||||
else if (*e_cpt == ']' || *e_cpt == 't')
|
||||
{
|
||||
msg_hist_off = TRUE; // reset in msg_trunc_attr()
|
||||
type = CTRL_X_TAGS;
|
||||
vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags."));
|
||||
(void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R));
|
||||
@@ -3423,9 +3426,11 @@ ins_compl_next(
|
||||
MB_PTR_ADV(s);
|
||||
}
|
||||
}
|
||||
msg_hist_off = TRUE;
|
||||
vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead,
|
||||
s > compl_shown_match->cp_fname ? "<" : "", s);
|
||||
msg((char *)IObuff);
|
||||
msg_hist_off = FALSE;
|
||||
redraw_cmdline = FALSE; // don't overwrite!
|
||||
}
|
||||
}
|
||||
@@ -4105,9 +4110,13 @@ ins_complete(int c, int enable_pum)
|
||||
if (edit_submode_extra != NULL)
|
||||
{
|
||||
if (!p_smd)
|
||||
{
|
||||
msg_hist_off = TRUE;
|
||||
msg_attr((char *)edit_submode_extra,
|
||||
edit_submode_highl < HLF_COUNT
|
||||
? HL_ATTR(edit_submode_highl) : 0);
|
||||
msg_hist_off = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
msg_clr_cmdline(); // necessary for "noshowmode"
|
||||
|
||||
@@ -5787,7 +5787,7 @@ nv_suspend(cmdarg_T *cap)
|
||||
clearop(cap->oap);
|
||||
if (VIsual_active)
|
||||
end_visual_mode(); // stop Visual mode
|
||||
do_cmdline_cmd((char_u *)"st");
|
||||
do_cmdline_cmd((char_u *)"stop");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -387,21 +387,13 @@ mch_FullName(
|
||||
int
|
||||
mch_isFullName(char_u *fname)
|
||||
{
|
||||
// WinNT and later can use _MAX_PATH wide characters for a pathname, which
|
||||
// means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
|
||||
// UTF-8.
|
||||
char szName[_MAX_PATH * 3 + 1];
|
||||
|
||||
// A name like "d:/foo" and "//server/share" is absolute
|
||||
if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\'))
|
||||
|| (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\')))
|
||||
return TRUE;
|
||||
|
||||
// A name that can't be made absolute probably isn't absolute.
|
||||
if (mch_FullName(fname, (char_u *)szName, sizeof(szName) - 1, FALSE) == FAIL)
|
||||
return FALSE;
|
||||
|
||||
return pathcmp((const char *)fname, (const char *)szName, -1) == 0;
|
||||
// A name like "d:/foo" and "//server/share" is absolute. "d:foo" is not.
|
||||
// Another way to check is to use mch_FullName() and see if the result is
|
||||
// the same as the name or mch_FullName() fails. However, this has quite a
|
||||
// bit of overhead, so let's not do that.
|
||||
return ((ASCII_ISALPHA(fname[0]) && fname[1] == ':'
|
||||
&& (fname[2] == '/' || fname[2] == '\\'))
|
||||
|| (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\')));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
1683
src/po/tr.po
1683
src/po/tr.po
File diff suppressed because it is too large
Load Diff
@@ -858,6 +858,7 @@ pum_set_selected(int n, int repeat UNUSED)
|
||||
// Edit a new, empty buffer. Set options for a "wipeout"
|
||||
// buffer.
|
||||
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
|
||||
set_option_value((char_u *)"bl", 0L, NULL, OPT_LOCAL);
|
||||
set_option_value((char_u *)"bt", 0L,
|
||||
(char_u *)"nofile", OPT_LOCAL);
|
||||
set_option_value((char_u *)"bh", 0L,
|
||||
|
||||
@@ -3868,20 +3868,19 @@ update_popups(void (*win_update)(win_T *wp))
|
||||
}
|
||||
if (top_padding > 0)
|
||||
{
|
||||
// top padding; do not draw over the title
|
||||
row = wp->w_winrow + wp->w_popup_border[0];
|
||||
if (title_len > 0)
|
||||
if (title_len > 0 && row == wp->w_winrow)
|
||||
{
|
||||
screen_fill(row, row + top_padding, padcol, title_wincol,
|
||||
// top padding and no border; do not draw over the title
|
||||
screen_fill(row, row + 1, padcol, title_wincol,
|
||||
' ', ' ', popup_attr);
|
||||
screen_fill(row, row + top_padding, title_wincol + title_len,
|
||||
screen_fill(row, row + 1, title_wincol + title_len,
|
||||
padendcol, ' ', ' ', popup_attr);
|
||||
row += 1;
|
||||
top_padding -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
screen_fill(row, row + top_padding, padcol, padendcol,
|
||||
screen_fill(row, row + top_padding, padcol, padendcol,
|
||||
' ', ' ', popup_attr);
|
||||
}
|
||||
}
|
||||
|
||||
// Compute scrollbar thumb position and size.
|
||||
|
||||
@@ -59,7 +59,7 @@ void check_vars(char_u *name, int len);
|
||||
dictitem_T *find_var(char_u *name, hashtab_T **htp, int no_autoload);
|
||||
dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload);
|
||||
hashtab_T *get_script_local_ht(void);
|
||||
void *lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy);
|
||||
int lookup_scriptvar(char_u *name, size_t len, void *lvar, cctx_T *dummy);
|
||||
hashtab_T *find_var_ht(char_u *name, char_u **varname);
|
||||
char_u *get_var_value(char_u *name);
|
||||
void new_script_vars(scid_T id);
|
||||
|
||||
@@ -13,7 +13,7 @@ void undo_cmdmod(cmdmod_T *cmod);
|
||||
int parse_cmd_address(exarg_T *eap, char **errormsg, int silent);
|
||||
int checkforcmd(char_u **pp, char *cmd, int len);
|
||||
char_u *skip_option_env_lead(char_u *start);
|
||||
char_u *find_ex_command(exarg_T *eap, int *full, void *(*lookup)(char_u *, size_t, cctx_T *), cctx_T *cctx);
|
||||
char_u *find_ex_command(exarg_T *eap, int *full, int (*lookup)(char_u *, size_t, void *, cctx_T *), cctx_T *cctx);
|
||||
int modifier_len(char_u *cmd);
|
||||
int cmd_exists(char_u *name);
|
||||
cmdidx_T excmd_get_cmdidx(char_u *cmd, int len);
|
||||
|
||||
@@ -10,6 +10,7 @@ varnumber_T tv_get_bool(typval_T *varp);
|
||||
varnumber_T tv_get_bool_chk(typval_T *varp, int *denote);
|
||||
float_T tv_get_float(typval_T *varp);
|
||||
int check_for_string(typval_T *tv);
|
||||
int check_for_nonempty_string(typval_T *tv);
|
||||
char_u *tv_get_string(typval_T *varp);
|
||||
char_u *tv_get_string_buf(typval_T *varp, char_u *buf);
|
||||
char_u *tv_get_string_chk(typval_T *varp);
|
||||
|
||||
@@ -1492,7 +1492,7 @@ almosttheend:
|
||||
if (si->sn_save_cpo != NULL)
|
||||
{
|
||||
set_option_value((char_u *)"cpo", 0L, si->sn_save_cpo, 0);
|
||||
si->sn_save_cpo = NULL;
|
||||
CLEAR_POINTER(si->sn_save_cpo);
|
||||
}
|
||||
|
||||
current_sctx = save_current_sctx;
|
||||
|
||||
10
src/testdir/dumps/Test_popupwin_longtitle_3.dump
Normal file
10
src/testdir/dumps/Test_popupwin_longtitle_3.dump
Normal file
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @73
|
||||
|3| @27| +0#0000001#ffd7ff255|T|i|t|l|e| @9| +0#0000000#ffffff0@29
|
||||
|4| @27| +0#0000001#ffd7ff255@15| +0#0000000#ffffff0@29
|
||||
|5| @27| +0#0000001#ffd7ff255@1|a@2| @10| +0#0000000#ffffff0@29
|
||||
|6| @27| +0#0000001#ffd7ff255@1|b@2| @10| +0#0000000#ffffff0@29
|
||||
|7| @27| +0#0000001#ffd7ff255@15| +0#0000000#ffffff0@29
|
||||
|8| @27| +0#0000001#ffd7ff255@15| +0#0000000#ffffff0@29
|
||||
|9| @73
|
||||
|:| @55|1|,|1| @10|T|o|p|
|
||||
10
src/testdir/dumps/Test_popupwin_longtitle_4.dump
Normal file
10
src/testdir/dumps/Test_popupwin_longtitle_4.dump
Normal file
@@ -0,0 +1,10 @@
|
||||
>1+0&#ffffff0| @73
|
||||
|2| @26|╔+0#0000001#ffd7ff255|T|i|t|l|e|═@10|╗| +0#0000000#ffffff0@28
|
||||
|3| @26|║+0#0000001#ffd7ff255| @15|║| +0#0000000#ffffff0@28
|
||||
|4| @26|║+0#0000001#ffd7ff255| @15|║| +0#0000000#ffffff0@28
|
||||
|5| @26|║+0#0000001#ffd7ff255| @1|a@2| @10|║| +0#0000000#ffffff0@28
|
||||
|6| @26|║+0#0000001#ffd7ff255| @1|b@2| @10|║| +0#0000000#ffffff0@28
|
||||
|7| @26|║+0#0000001#ffd7ff255| @15|║| +0#0000000#ffffff0@28
|
||||
|8| @26|║+0#0000001#ffd7ff255| @15|║| +0#0000000#ffffff0@28
|
||||
|9| @26|╚+0#0000001#ffd7ff255|═@15|╝| +0#0000000#ffffff0@28
|
||||
|:| @55|1|,|1| @10|T|o|p|
|
||||
@@ -114,7 +114,7 @@ func Test_omni_dash()
|
||||
set omnifunc=Omni
|
||||
new
|
||||
exe "normal Gofind -\<C-x>\<C-o>"
|
||||
call assert_equal("\n-\nmatch 1 of 2", execute(':2mess'))
|
||||
call assert_equal("find -help", getline('$'))
|
||||
|
||||
bwipe!
|
||||
delfunc Omni
|
||||
@@ -714,4 +714,16 @@ func Test_issue_7021()
|
||||
set completeslash=
|
||||
endfunc
|
||||
|
||||
" Test to ensure 'Scanning...' messages are not recorded in messages history
|
||||
func Test_z1_complete_no_history()
|
||||
new
|
||||
messages clear
|
||||
let currmess = execute('messages')
|
||||
setlocal dictionary=README.txt
|
||||
exe "normal owh\<C-X>\<C-K>"
|
||||
exe "normal owh\<C-N>"
|
||||
call assert_equal(currmess, execute('messages'))
|
||||
close!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -338,7 +338,7 @@ func Test_let_heredoc_fails()
|
||||
endfunc
|
||||
END
|
||||
call writefile(text, 'XheredocFail')
|
||||
call assert_fails('source XheredocFail', 'E126:')
|
||||
call assert_fails('source XheredocFail', 'E1145:')
|
||||
call delete('XheredocFail')
|
||||
|
||||
let text =<< trim CodeEnd
|
||||
@@ -347,7 +347,7 @@ func Test_let_heredoc_fails()
|
||||
endfunc
|
||||
CodeEnd
|
||||
call writefile(text, 'XheredocWrong')
|
||||
call assert_fails('source XheredocWrong', 'E126:')
|
||||
call assert_fails('source XheredocWrong', 'E1145:')
|
||||
call delete('XheredocWrong')
|
||||
|
||||
let text =<< trim TEXTend
|
||||
|
||||
@@ -1766,6 +1766,16 @@ func Test_popup_title()
|
||||
call term_sendkeys(buf, ":\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_popupwin_longtitle_2', {})
|
||||
|
||||
call term_sendkeys(buf, ":call popup_clear()\<CR>")
|
||||
call term_sendkeys(buf, ":call popup_create(['aaa', 'bbb'], #{title: 'Title', minwidth: 12, padding: [2, 2, 2, 2]})\<CR>")
|
||||
call term_sendkeys(buf, ":\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_popupwin_longtitle_3', {})
|
||||
|
||||
call term_sendkeys(buf, ":call popup_clear()\<CR>")
|
||||
call term_sendkeys(buf, ":call popup_create(['aaa', 'bbb'], #{title: 'Title', minwidth: 12, border: [], padding: [2, 2, 2, 2]})\<CR>")
|
||||
call term_sendkeys(buf, ":\<CR>")
|
||||
call VerifyScreenDump(buf, 'Test_popupwin_longtitle_4', {})
|
||||
|
||||
" clean up
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('XtestPopupTitle')
|
||||
@@ -3215,6 +3225,9 @@ func Get_popupmenu_lines()
|
||||
call setline(1, 'text text text text text text text ')
|
||||
func ChangeColor()
|
||||
let id = popup_findinfo()
|
||||
if buflisted(winbufnr(id))
|
||||
call setline(1, 'buffer is listed')
|
||||
endif
|
||||
eval id->popup_setoptions(#{highlight: 'InfoPopup'})
|
||||
endfunc
|
||||
|
||||
|
||||
@@ -61,4 +61,48 @@ func Test_suspend()
|
||||
call delete('Xfoo')
|
||||
endfunc
|
||||
|
||||
func Test_suspend_autocmd()
|
||||
CheckFeature terminal
|
||||
CheckExecutable /bin/sh
|
||||
|
||||
let buf = term_start('/bin/sh', #{term_rows: 6})
|
||||
" Wait for shell prompt.
|
||||
call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
|
||||
|
||||
call term_sendkeys(buf, v:progpath
|
||||
\ . " --clean -X"
|
||||
\ . " -c 'set nu'"
|
||||
\ . " -c 'let g:count = 0'"
|
||||
\ . " -c 'au VimSuspend * let g:count += 1'"
|
||||
\ . " -c 'au VimResume * let g:count += 1'"
|
||||
\ . " -c 'call setline(1, \"foo\")'"
|
||||
\ . " Xfoo\<CR>")
|
||||
" Cursor in terminal buffer should be on first line in spawned vim.
|
||||
call WaitForAssert({-> assert_equal(' 1 foo', term_getline(buf, '.'))})
|
||||
|
||||
for suspend_cmd in [":suspend\<CR>",
|
||||
\ ":stop\<CR>",
|
||||
\ ":suspend!\<CR>",
|
||||
\ ":stop!\<CR>",
|
||||
\ "\<C-Z>"]
|
||||
" Suspend and wait for shell prompt. Then "fg" will restore Vim.
|
||||
call term_sendkeys(buf, suspend_cmd)
|
||||
call CheckSuspended(buf, 0)
|
||||
endfor
|
||||
|
||||
call term_sendkeys(buf, ":echo g:count\<CR>")
|
||||
call TermWait(buf)
|
||||
call WaitForAssert({-> assert_match('^10', term_getline(buf, 6))})
|
||||
|
||||
" Quit gracefully to dump coverage information.
|
||||
call term_sendkeys(buf, ":qall!\<CR>")
|
||||
call TermWait(buf)
|
||||
" Wait until Vim actually exited and shell shows a prompt
|
||||
call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
|
||||
call StopShellInTerminal(buf)
|
||||
|
||||
exe buf . 'bwipe!'
|
||||
call delete('Xfoo')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -326,6 +326,18 @@ def Test_assign_index()
|
||||
END
|
||||
CheckDefFailure(lines, 'E1012: Type mismatch; expected number but got dict<unknown>', 3)
|
||||
|
||||
lines =<< trim END
|
||||
var lines: list<string>
|
||||
lines['a'] = 'asdf'
|
||||
END
|
||||
CheckDefFailure(lines, 'E39:', 2)
|
||||
|
||||
lines =<< trim END
|
||||
var lines: string
|
||||
lines[9] = 'asdf'
|
||||
END
|
||||
CheckDefFailure(lines, 'E1141:', 2)
|
||||
|
||||
# list of dict
|
||||
var ld: list<dict<number>>
|
||||
ld[0] = {}
|
||||
@@ -982,6 +994,17 @@ def Test_heredoc()
|
||||
var&lines =<< trim END
|
||||
x
|
||||
x
|
||||
enddef
|
||||
defcompile
|
||||
[END]
|
||||
CheckScriptFailure(lines, 'E1145: Missing heredoc end marker: END')
|
||||
delfunc! g:Func
|
||||
|
||||
lines =<< trim [END]
|
||||
def Func()
|
||||
var lines =<< trim END
|
||||
x
|
||||
x
|
||||
x
|
||||
x
|
||||
x
|
||||
@@ -991,7 +1014,7 @@ def Test_heredoc()
|
||||
enddef
|
||||
call Func()
|
||||
[END]
|
||||
CheckScriptFailure(lines, 'E990:')
|
||||
CheckScriptFailure(lines, 'E1145: Missing heredoc end marker: END')
|
||||
delfunc! g:Func
|
||||
enddef
|
||||
|
||||
|
||||
@@ -186,15 +186,17 @@ def Test_count()
|
||||
enddef
|
||||
|
||||
def Test_executable()
|
||||
assert_false(executable(""))
|
||||
assert_false(executable(test_null_string()))
|
||||
|
||||
CheckDefExecFailure(['echo executable(123)'], 'E928:')
|
||||
CheckDefExecFailure(['echo executable(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo executable(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo executable("")'], 'E928:')
|
||||
enddef
|
||||
|
||||
def Test_exepath()
|
||||
CheckDefExecFailure(['echo exepath(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo exepath(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo exepath("")'], 'E928:')
|
||||
CheckDefExecFailure(['echo exepath("")'], 'E1142:')
|
||||
enddef
|
||||
|
||||
def Test_expand()
|
||||
@@ -254,36 +256,42 @@ def Test_map_function_arg()
|
||||
enddef
|
||||
|
||||
def Test_filereadable()
|
||||
assert_false(filereadable(""))
|
||||
assert_false(filereadable(test_null_string()))
|
||||
|
||||
CheckDefExecFailure(['echo filereadable(123)'], 'E928:')
|
||||
CheckDefExecFailure(['echo filereadable(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo filereadable(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo filereadable("")'], 'E928:')
|
||||
enddef
|
||||
|
||||
def Test_filewritable()
|
||||
assert_false(filewritable(""))
|
||||
assert_false(filewritable(test_null_string()))
|
||||
|
||||
CheckDefExecFailure(['echo filewritable(123)'], 'E928:')
|
||||
CheckDefExecFailure(['echo filewritable(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo filewritable(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo filewritable("")'], 'E928:')
|
||||
enddef
|
||||
|
||||
def Test_finddir()
|
||||
CheckDefExecFailure(['echo finddir(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo finddir(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo finddir("")'], 'E928:')
|
||||
CheckDefExecFailure(['echo finddir("")'], 'E1142:')
|
||||
enddef
|
||||
|
||||
def Test_findfile()
|
||||
CheckDefExecFailure(['echo findfile(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo findfile(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo findfile("")'], 'E928:')
|
||||
CheckDefExecFailure(['echo findfile("")'], 'E1142:')
|
||||
enddef
|
||||
|
||||
def Test_fnamemodify()
|
||||
CheckDefSuccess(['echo fnamemodify(test_null_string(), ":p")'])
|
||||
CheckDefSuccess(['echo fnamemodify("", ":p")'])
|
||||
CheckDefSuccess(['echo fnamemodify("file", test_null_string())'])
|
||||
CheckDefSuccess(['echo fnamemodify("file", "")'])
|
||||
|
||||
CheckDefExecFailure(['echo fnamemodify(true, ":p")'], 'E928:')
|
||||
CheckDefExecFailure(['echo fnamemodify(v:null, ":p")'], 'E928:')
|
||||
CheckDefExecFailure(['echo fnamemodify("", ":p")'], 'E928:')
|
||||
CheckDefExecFailure(['echo fnamemodify("file", true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo fnamemodify("file", v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo fnamemodify("file", "")'], 'E928:')
|
||||
enddef
|
||||
|
||||
def Test_filter_wrong_dict_key_type()
|
||||
@@ -359,27 +367,35 @@ def Test_getloclist_return_type()
|
||||
enddef
|
||||
|
||||
def Test_getfperm()
|
||||
assert_equal('', getfperm(""))
|
||||
assert_equal('', getfperm(test_null_string()))
|
||||
|
||||
CheckDefExecFailure(['echo getfperm(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo getfperm(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo getfperm("")'], 'E928:')
|
||||
enddef
|
||||
|
||||
def Test_getfsize()
|
||||
assert_equal(-1, getfsize(""))
|
||||
assert_equal(-1, getfsize(test_null_string()))
|
||||
|
||||
CheckDefExecFailure(['echo getfsize(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo getfsize(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo getfsize("")'], 'E928:')
|
||||
enddef
|
||||
|
||||
def Test_getftime()
|
||||
assert_equal(-1, getftime(""))
|
||||
assert_equal(-1, getftime(test_null_string()))
|
||||
|
||||
CheckDefExecFailure(['echo getftime(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo getftime(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo getftime("")'], 'E928:')
|
||||
enddef
|
||||
|
||||
def Test_getftype()
|
||||
assert_equal('', getftype(""))
|
||||
assert_equal('', getftype(test_null_string()))
|
||||
|
||||
CheckDefExecFailure(['echo getftype(true)'], 'E928:')
|
||||
CheckDefExecFailure(['echo getftype(v:null)'], 'E928:')
|
||||
CheckDefExecFailure(['echo getftype("")'], 'E928:')
|
||||
enddef
|
||||
|
||||
def Test_getqflist_return_type()
|
||||
|
||||
@@ -614,6 +614,17 @@ def Test_put_command()
|
||||
assert_equal('above', getline(3))
|
||||
assert_equal('below', getline(4))
|
||||
|
||||
# compute range at runtime
|
||||
setline(1, range(1, 8))
|
||||
@a = 'aaa'
|
||||
:$-2put a
|
||||
assert_equal('aaa', getline(7))
|
||||
|
||||
setline(1, range(1, 8))
|
||||
:2
|
||||
:+2put! a
|
||||
assert_equal('aaa', getline(4))
|
||||
|
||||
bwipe!
|
||||
enddef
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ let t:tabpagevar = 't'
|
||||
def s:ScriptFuncLoad(arg: string)
|
||||
var local = 1
|
||||
buffers
|
||||
echo
|
||||
echo arg
|
||||
echo local
|
||||
echo &lines
|
||||
@@ -43,14 +44,27 @@ def Test_disassemble_load()
|
||||
|
||||
var res = execute('disass s:ScriptFuncLoad')
|
||||
assert_match('<SNR>\d*_ScriptFuncLoad.*' ..
|
||||
'buffers.*' ..
|
||||
' EXEC \+buffers.*' ..
|
||||
' LOAD arg\[-1\].*' ..
|
||||
' LOAD $0.*' ..
|
||||
' LOADOPT &lines.*' ..
|
||||
' LOADV v:version.*' ..
|
||||
' LOADS s:scriptvar from .*test_vim9_disassemble.vim.*' ..
|
||||
' LOADG g:globalvar.*' ..
|
||||
'buffers\_s*' ..
|
||||
'\d\+ EXEC \+buffers\_s*' ..
|
||||
'echo\_s*' ..
|
||||
'echo arg\_s*' ..
|
||||
'\d\+ LOAD arg\[-1\]\_s*' ..
|
||||
'\d\+ ECHO 1\_s*' ..
|
||||
'echo local\_s*' ..
|
||||
'\d\+ LOAD $0\_s*' ..
|
||||
'\d\+ ECHO 1\_s*' ..
|
||||
'echo &lines\_s*' ..
|
||||
'\d\+ LOADOPT &lines\_s*' ..
|
||||
'\d\+ ECHO 1\_s*' ..
|
||||
'echo v:version\_s*' ..
|
||||
'\d\+ LOADV v:version\_s*' ..
|
||||
'\d\+ ECHO 1\_s*' ..
|
||||
'echo s:scriptvar\_s*' ..
|
||||
'\d\+ LOADS s:scriptvar from .*test_vim9_disassemble.vim\_s*' ..
|
||||
'\d\+ ECHO 1\_s*' ..
|
||||
'echo g:globalvar\_s*' ..
|
||||
'\d\+ LOADG g:globalvar\_s*' ..
|
||||
'\d\+ ECHO 1\_s*' ..
|
||||
'echo get(g:, "global")\_s*' ..
|
||||
'\d\+ LOAD g:\_s*' ..
|
||||
'\d\+ PUSHS "global"\_s*' ..
|
||||
@@ -133,6 +147,21 @@ def Test_disassemble_put_expr()
|
||||
res)
|
||||
enddef
|
||||
|
||||
def s:PutRange()
|
||||
:$-2put a
|
||||
enddef
|
||||
|
||||
def Test_disassemble_put_range()
|
||||
var res = execute('disass s:PutRange')
|
||||
assert_match('<SNR>\d*_PutRange.*' ..
|
||||
' :$-2put a\_s*' ..
|
||||
'\d RANGE $-2\_s*' ..
|
||||
'\d PUT a range\_s*' ..
|
||||
'\d PUSHNR 0\_s*' ..
|
||||
'\d RETURN',
|
||||
res)
|
||||
enddef
|
||||
|
||||
def s:ScriptFuncPush()
|
||||
var localbool = true
|
||||
var localspec = v:none
|
||||
|
||||
@@ -481,6 +481,12 @@ def Test_call_lambda_args()
|
||||
CheckDefFailure(lines, 'E1013: Argument 2: type mismatch, expected number but got string')
|
||||
enddef
|
||||
|
||||
def Test_lambda_uses_assigned_var()
|
||||
CheckDefSuccess([
|
||||
'var x: any = "aaa"'
|
||||
'x = filter(["bbb"], {_, v -> v =~ x})'])
|
||||
enddef
|
||||
|
||||
" Default arg and varargs
|
||||
def MyDefVarargs(one: string, two = 'foo', ...rest: list<string>): string
|
||||
var res = one .. ',' .. two
|
||||
@@ -1818,6 +1824,26 @@ def Test_reset_did_emsg()
|
||||
delfunc! g:Func
|
||||
enddef
|
||||
|
||||
def Test_did_emsg_reset()
|
||||
# executing an autocommand resets did_emsg, this should not result in a
|
||||
# builtin function considered failing
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
au BufWinLeave * #
|
||||
def Func()
|
||||
popup_menu('', {callback: {-> popup_create('', {})->popup_close()}})
|
||||
eval [][0]
|
||||
enddef
|
||||
nno <F3> <cmd>call <sid>Func()<cr>
|
||||
feedkeys("\<F3>\e", 'xt')
|
||||
END
|
||||
writefile(lines, 'XemsgReset')
|
||||
assert_fails('so XemsgReset', ['E684:', 'E684:'], lines, 2)
|
||||
delete('XemsgReset')
|
||||
nunmap <F3>
|
||||
au! BufWinLeave
|
||||
enddef
|
||||
|
||||
def Test_abort_with_silent_call()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
|
||||
@@ -620,7 +620,7 @@ def Test_try_catch_fails()
|
||||
CheckDefFailure(['if 1', 'endtry'], 'E171:')
|
||||
CheckDefFailure(['try', 'echo 1', 'endtry'], 'E1032:')
|
||||
|
||||
CheckDefFailure(['throw'], 'E1015:')
|
||||
CheckDefFailure(['throw'], 'E1143:')
|
||||
CheckDefFailure(['throw xxx'], 'E1001:')
|
||||
enddef
|
||||
|
||||
@@ -1719,6 +1719,10 @@ def Test_nested_if()
|
||||
enddef
|
||||
|
||||
def Test_execute_cmd()
|
||||
# missing argument is ignored
|
||||
execute
|
||||
execute # comment
|
||||
|
||||
new
|
||||
setline(1, 'default')
|
||||
execute 'setline(1, "execute-string")'
|
||||
@@ -2069,7 +2073,21 @@ def Test_vim9_comment()
|
||||
CheckScriptSuccess([
|
||||
'vim9script',
|
||||
'# something',
|
||||
'#something',
|
||||
'#{something',
|
||||
])
|
||||
|
||||
split Xfile
|
||||
CheckScriptSuccess([
|
||||
'vim9script',
|
||||
'edit #something',
|
||||
])
|
||||
CheckScriptSuccess([
|
||||
'vim9script',
|
||||
'edit #{something',
|
||||
])
|
||||
close
|
||||
|
||||
CheckScriptFailure([
|
||||
'vim9script',
|
||||
':# something',
|
||||
@@ -2123,9 +2141,6 @@ def Test_vim9_comment()
|
||||
'vim9script',
|
||||
'exe "echo"# something',
|
||||
], 'E121:')
|
||||
CheckDefFailure([
|
||||
'exe # comment',
|
||||
], 'E1015:')
|
||||
CheckScriptFailure([
|
||||
'vim9script',
|
||||
'exe# something',
|
||||
@@ -2150,7 +2165,7 @@ def Test_vim9_comment()
|
||||
' throw#comment',
|
||||
'catch',
|
||||
'endtry',
|
||||
], 'E1015:')
|
||||
], 'E1143:')
|
||||
CheckDefFailure([
|
||||
'try',
|
||||
' throw "yes"#comment',
|
||||
@@ -2381,6 +2396,27 @@ def Test_vim9_comment()
|
||||
'Echo',
|
||||
], 'E121:')
|
||||
delcommand Echo
|
||||
|
||||
var curdir = getcwd()
|
||||
CheckScriptSuccess([
|
||||
'command Echo cd " comment',
|
||||
'Echo',
|
||||
'delcommand Echo',
|
||||
])
|
||||
CheckScriptSuccess([
|
||||
'vim9script'
|
||||
'command Echo cd # comment',
|
||||
'Echo',
|
||||
'delcommand Echo',
|
||||
])
|
||||
CheckScriptFailure([
|
||||
'vim9script',
|
||||
'command Echo cd " comment',
|
||||
'Echo',
|
||||
], 'E344:')
|
||||
delcommand Echo
|
||||
chdir(curdir)
|
||||
|
||||
CheckScriptFailure([
|
||||
'vim9script',
|
||||
'command Echo# comment',
|
||||
@@ -3022,7 +3058,7 @@ def Test_put_with_linebreak()
|
||||
new
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
pu=split('abc', '\zs')
|
||||
pu =split('abc', '\zs')
|
||||
->join()
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
@@ -3043,6 +3079,13 @@ def Test_invoke_normal_in_visual_mode()
|
||||
xunmap <F3>
|
||||
enddef
|
||||
|
||||
def Test_white_space_after_command()
|
||||
var lines =<< trim END
|
||||
exit_cb: Func})
|
||||
END
|
||||
CheckDefAndScriptFailure(lines, 'E1144:', 1)
|
||||
enddef
|
||||
|
||||
" Keep this last, it messes up highlighting.
|
||||
def Test_substitute_cmd()
|
||||
new
|
||||
|
||||
22
src/typval.c
22
src/typval.c
@@ -341,14 +341,12 @@ tv_get_float(typval_T *varp)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Give an error and return FAIL unless "tv" is a non-empty string.
|
||||
* Give an error and return FAIL unless "tv" is a string.
|
||||
*/
|
||||
int
|
||||
check_for_string(typval_T *tv)
|
||||
{
|
||||
if (tv->v_type != VAR_STRING
|
||||
|| tv->vval.v_string == NULL
|
||||
|| *tv->vval.v_string == NUL)
|
||||
if (tv->v_type != VAR_STRING)
|
||||
{
|
||||
emsg(_(e_stringreq));
|
||||
return FAIL;
|
||||
@@ -356,6 +354,22 @@ check_for_string(typval_T *tv)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Give an error and return FAIL unless "tv" is a non-empty string.
|
||||
*/
|
||||
int
|
||||
check_for_nonempty_string(typval_T *tv)
|
||||
{
|
||||
if (check_for_string(tv) == FAIL)
|
||||
return FAIL;
|
||||
if (tv->vval.v_string == NULL || *tv->vval.v_string == NUL)
|
||||
{
|
||||
emsg(_(e_non_empty_string_required));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the string value of a variable.
|
||||
* If it is a Number variable, the number is converted into a string.
|
||||
|
||||
@@ -3185,7 +3185,9 @@ define_function(exarg_T *eap, char_u *name_arg)
|
||||
lines_left = Rows - 1;
|
||||
if (theline == NULL)
|
||||
{
|
||||
if (eap->cmdidx == CMD_def)
|
||||
if (skip_until != NULL)
|
||||
semsg(_(e_missing_heredoc_end_marker_str), skip_until);
|
||||
else if (eap->cmdidx == CMD_def)
|
||||
emsg(_(e_missing_enddef));
|
||||
else
|
||||
emsg(_("E126: Missing :endfunction"));
|
||||
@@ -3352,18 +3354,24 @@ define_function(exarg_T *eap, char_u *name_arg)
|
||||
|
||||
// Check for ":cmd v =<< [trim] EOF"
|
||||
// and ":cmd [a, b] =<< [trim] EOF"
|
||||
// and "lines =<< [trim] EOF" for Vim9
|
||||
// Where "cmd" can be "let", "var", "final" or "const".
|
||||
arg = skipwhite(skiptowhite(p));
|
||||
if (*arg == '[')
|
||||
arg = vim_strchr(arg, ']');
|
||||
if (arg != NULL)
|
||||
{
|
||||
arg = skipwhite(skiptowhite(arg));
|
||||
if (arg[0] == '=' && arg[1] == '<' && arg[2] =='<'
|
||||
int found = (eap->cmdidx == CMD_def && arg[0] == '='
|
||||
&& arg[1] == '<' && arg[2] =='<');
|
||||
|
||||
if (!found)
|
||||
// skip over the argument after "cmd"
|
||||
arg = skipwhite(skiptowhite(arg));
|
||||
if (found || (arg[0] == '=' && arg[1] == '<' && arg[2] =='<'
|
||||
&& (checkforcmd(&p, "let", 2)
|
||||
|| checkforcmd(&p, "var", 3)
|
||||
|| checkforcmd(&p, "final", 5)
|
||||
|| checkforcmd(&p, "const", 5)))
|
||||
|| checkforcmd(&p, "const", 5))))
|
||||
{
|
||||
p = skipwhite(arg + 3);
|
||||
if (STRNCMP(p, "trim", 4) == 0)
|
||||
|
||||
@@ -750,6 +750,40 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2139,
|
||||
/**/
|
||||
2138,
|
||||
/**/
|
||||
2137,
|
||||
/**/
|
||||
2136,
|
||||
/**/
|
||||
2135,
|
||||
/**/
|
||||
2134,
|
||||
/**/
|
||||
2133,
|
||||
/**/
|
||||
2132,
|
||||
/**/
|
||||
2131,
|
||||
/**/
|
||||
2130,
|
||||
/**/
|
||||
2129,
|
||||
/**/
|
||||
2128,
|
||||
/**/
|
||||
2127,
|
||||
/**/
|
||||
2126,
|
||||
/**/
|
||||
2125,
|
||||
/**/
|
||||
2124,
|
||||
/**/
|
||||
2123,
|
||||
/**/
|
||||
2122,
|
||||
/**/
|
||||
|
||||
@@ -1344,6 +1344,8 @@ enum auto_event
|
||||
EVENT_WINENTER, // after entering a window
|
||||
EVENT_WINLEAVE, // before leaving a window
|
||||
EVENT_WINNEW, // when entering a new window
|
||||
EVENT_VIMSUSPEND, // before Vim is suspended
|
||||
EVENT_VIMRESUME, // after Vim is resumed
|
||||
|
||||
NUM_EVENTS // MUST be the last one
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@ typedef enum {
|
||||
ISN_EXECUTE, // execute Ex commands isn_arg.number items on top of stack
|
||||
ISN_ECHOMSG, // echo Ex commands isn_arg.number items on top of stack
|
||||
ISN_ECHOERR, // echo Ex commands isn_arg.number items on top of stack
|
||||
ISN_RANGE, // compute range from isn_arg.string, push to stack
|
||||
|
||||
// get and set variables
|
||||
ISN_LOAD, // push local variable isn_arg.number
|
||||
@@ -366,3 +367,8 @@ garray_T def_functions = {0, 0, sizeof(dfunc_T), 50, NULL};
|
||||
extern garray_T def_functions;
|
||||
#endif
|
||||
|
||||
// Used for "lnum" when a range is to be taken from the stack.
|
||||
#define LNUM_VARIABLE_RANGE -999
|
||||
|
||||
// Used for "lnum" when a range is to be taken from the stack and "!" is used.
|
||||
#define LNUM_VARIABLE_RANGE_ABOVE -888
|
||||
|
||||
@@ -148,45 +148,51 @@ struct cctx_S {
|
||||
static void delete_def_function_contents(dfunc_T *dfunc);
|
||||
|
||||
/*
|
||||
* Lookup variable "name" in the local scope and return it.
|
||||
* Return NULL if not found.
|
||||
* Lookup variable "name" in the local scope and return it in "lvar".
|
||||
* "lvar->lv_from_outer" is set accordingly.
|
||||
* If "lvar" is NULL only check if the variable can be found.
|
||||
* Return FAIL if not found.
|
||||
*/
|
||||
static lvar_T *
|
||||
lookup_local(char_u *name, size_t len, cctx_T *cctx)
|
||||
static int
|
||||
lookup_local(char_u *name, size_t len, lvar_T *lvar, cctx_T *cctx)
|
||||
{
|
||||
int idx;
|
||||
lvar_T *lvar;
|
||||
lvar_T *lvp;
|
||||
|
||||
if (len == 0)
|
||||
return NULL;
|
||||
return FAIL;
|
||||
|
||||
// Find local in current function scope.
|
||||
for (idx = 0; idx < cctx->ctx_locals.ga_len; ++idx)
|
||||
{
|
||||
lvar = ((lvar_T *)cctx->ctx_locals.ga_data) + idx;
|
||||
if (STRNCMP(name, lvar->lv_name, len) == 0
|
||||
&& STRLEN(lvar->lv_name) == len)
|
||||
lvp = ((lvar_T *)cctx->ctx_locals.ga_data) + idx;
|
||||
if (STRNCMP(name, lvp->lv_name, len) == 0
|
||||
&& STRLEN(lvp->lv_name) == len)
|
||||
{
|
||||
lvar->lv_from_outer = FALSE;
|
||||
return lvar;
|
||||
if (lvar != NULL)
|
||||
{
|
||||
*lvar = *lvp;
|
||||
lvar->lv_from_outer = FALSE;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Find local in outer function scope.
|
||||
if (cctx->ctx_outer != NULL)
|
||||
{
|
||||
lvar = lookup_local(name, len, cctx->ctx_outer);
|
||||
if (lvar != NULL)
|
||||
if (lookup_local(name, len, lvar, cctx->ctx_outer) == OK)
|
||||
{
|
||||
// TODO: are there situations we should not mark the outer scope as
|
||||
// used?
|
||||
cctx->ctx_outer_used = TRUE;
|
||||
lvar->lv_from_outer = TRUE;
|
||||
return lvar;
|
||||
if (lvar != NULL)
|
||||
{
|
||||
cctx->ctx_outer_used = TRUE;
|
||||
lvar->lv_from_outer = TRUE;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -377,7 +383,7 @@ check_defined(char_u *p, size_t len, cctx_T *cctx)
|
||||
p[len] = NUL;
|
||||
if (script_var_exists(p, len, FALSE, cctx) == OK
|
||||
|| (cctx != NULL
|
||||
&& (lookup_local(p, len, cctx) != NULL
|
||||
&& (lookup_local(p, len, NULL, cctx) == OK
|
||||
|| arg_exists(p, len, NULL, NULL, NULL, cctx) == OK))
|
||||
|| find_imported(p, len, cctx) != NULL
|
||||
|| (ufunc = find_func_even_dead(p, FALSE, cctx)) != NULL)
|
||||
@@ -1888,6 +1894,26 @@ generate_EXECCONCAT(cctx_T *cctx, int count)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate ISN_RANGE. Consumes "range". Return OK/FAIL.
|
||||
*/
|
||||
static int
|
||||
generate_RANGE(cctx_T *cctx, char_u *range)
|
||||
{
|
||||
isn_T *isn;
|
||||
garray_T *stack = &cctx->ctx_type_stack;
|
||||
|
||||
if ((isn = generate_instr(cctx, ISN_RANGE)) == NULL)
|
||||
return FAIL;
|
||||
isn->isn_arg.string = range;
|
||||
|
||||
if (ga_grow(stack, 1) == FAIL)
|
||||
return FAIL;
|
||||
((type_T **)stack->ga_data)[stack->ga_len] = &t_number;
|
||||
++stack->ga_len;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int
|
||||
generate_UNPACK(cctx_T *cctx, int var_count, int semicolon)
|
||||
{
|
||||
@@ -2535,13 +2561,13 @@ compile_load(
|
||||
}
|
||||
else
|
||||
{
|
||||
lvar_T *lvar = lookup_local(*arg, len, cctx);
|
||||
lvar_T lvar;
|
||||
|
||||
if (lvar != NULL)
|
||||
if (lookup_local(*arg, len, &lvar, cctx) == OK)
|
||||
{
|
||||
type = lvar->lv_type;
|
||||
idx = lvar->lv_idx;
|
||||
if (lvar->lv_from_outer)
|
||||
type = lvar.lv_type;
|
||||
idx = lvar.lv_idx;
|
||||
if (lvar.lv_from_outer)
|
||||
gen_load_outer = TRUE;
|
||||
else
|
||||
gen_load = TRUE;
|
||||
@@ -2743,7 +2769,7 @@ compile_call(
|
||||
|
||||
// An argument or local variable can be a function reference, this
|
||||
// overrules a function name.
|
||||
if (lookup_local(namebuf, varlen, cctx) == NULL
|
||||
if (lookup_local(namebuf, varlen, NULL, cctx) == FAIL
|
||||
&& arg_exists(namebuf, varlen, NULL, NULL, NULL, cctx) != OK)
|
||||
{
|
||||
// If we can find the function by name generate the right call.
|
||||
@@ -3949,7 +3975,10 @@ compile_expr7(
|
||||
|
||||
if (!eval_isnamec1(**arg))
|
||||
{
|
||||
semsg(_(e_name_expected), *arg);
|
||||
if (ends_excmd(*skipwhite(*arg)))
|
||||
semsg(_(e_empty_expression_str), *arg);
|
||||
else
|
||||
semsg(_(e_name_expected_str), *arg);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -5346,6 +5375,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
||||
assign_dest_T dest = dest_local;
|
||||
int opt_flags = 0;
|
||||
int vimvaridx = -1;
|
||||
lvar_T local_lvar;
|
||||
lvar_T *lvar = NULL;
|
||||
lvar_T arg_lvar;
|
||||
int has_type = FALSE;
|
||||
@@ -5404,8 +5434,10 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
||||
goto theend;
|
||||
}
|
||||
|
||||
lvar = lookup_local(var_start, varlen, cctx);
|
||||
if (lvar == NULL)
|
||||
|
||||
if (lookup_local(var_start, varlen, &local_lvar, cctx) == OK)
|
||||
lvar = &local_lvar;
|
||||
else
|
||||
{
|
||||
CLEAR_FIELD(arg_lvar);
|
||||
if (arg_exists(var_start, varlen,
|
||||
@@ -5824,8 +5856,6 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
||||
int r;
|
||||
|
||||
// Compile the "idx" in "var[idx]" or "key" in "var.key".
|
||||
if (new_local)
|
||||
--cctx->ctx_locals.ga_len;
|
||||
p = var_start + varlen;
|
||||
if (*p == '[')
|
||||
{
|
||||
@@ -5845,8 +5875,6 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
|
||||
|
||||
r = generate_PUSHS(cctx, key);
|
||||
}
|
||||
if (new_local)
|
||||
++cctx->ctx_locals.ga_len;
|
||||
if (r == FAIL)
|
||||
goto theend;
|
||||
|
||||
@@ -6559,8 +6587,7 @@ compile_for(char_u *arg_start, cctx_T *cctx)
|
||||
}
|
||||
else
|
||||
{
|
||||
var_lvar = lookup_local(arg, varlen, cctx);
|
||||
if (var_lvar != NULL)
|
||||
if (lookup_local(arg, varlen, NULL, cctx) == OK)
|
||||
{
|
||||
semsg(_(e_variable_already_declared), arg);
|
||||
goto failed;
|
||||
@@ -7073,31 +7100,50 @@ compile_throw(char_u *arg, cctx_T *cctx UNUSED)
|
||||
compile_mult_expr(char_u *arg, int cmdidx, cctx_T *cctx)
|
||||
{
|
||||
char_u *p = arg;
|
||||
char_u *prev;
|
||||
char_u *prev = arg;
|
||||
int count = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (ends_excmd2(prev, p))
|
||||
break;
|
||||
if (compile_expr0(&p, cctx) == FAIL)
|
||||
return NULL;
|
||||
++count;
|
||||
prev = p;
|
||||
p = skipwhite(p);
|
||||
if (ends_excmd2(prev, p))
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmdidx == CMD_echo || cmdidx == CMD_echon)
|
||||
generate_ECHO(cctx, cmdidx == CMD_echo, count);
|
||||
else if (cmdidx == CMD_execute)
|
||||
generate_MULT_EXPR(cctx, ISN_EXECUTE, count);
|
||||
else if (cmdidx == CMD_echomsg)
|
||||
generate_MULT_EXPR(cctx, ISN_ECHOMSG, count);
|
||||
else
|
||||
generate_MULT_EXPR(cctx, ISN_ECHOERR, count);
|
||||
if (count > 0)
|
||||
{
|
||||
if (cmdidx == CMD_echo || cmdidx == CMD_echon)
|
||||
generate_ECHO(cctx, cmdidx == CMD_echo, count);
|
||||
else if (cmdidx == CMD_execute)
|
||||
generate_MULT_EXPR(cctx, ISN_EXECUTE, count);
|
||||
else if (cmdidx == CMD_echomsg)
|
||||
generate_MULT_EXPR(cctx, ISN_ECHOMSG, count);
|
||||
else
|
||||
generate_MULT_EXPR(cctx, ISN_ECHOERR, count);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* If "eap" has a range that is not a contstant generate an ISN_RANGE
|
||||
* instruction to compute it and return OK.
|
||||
* Otherwise return FAIL, the caller must deal with any range.
|
||||
*/
|
||||
static int
|
||||
compile_variable_range(exarg_T *eap, cctx_T *cctx)
|
||||
{
|
||||
char_u *range_end = skip_range(eap->cmd, TRUE, NULL);
|
||||
char_u *p = skipdigits(eap->cmd);
|
||||
|
||||
if (p == range_end)
|
||||
return FAIL;
|
||||
return generate_RANGE(cctx, vim_strnsave(eap->cmd, range_end - eap->cmd));
|
||||
}
|
||||
|
||||
/*
|
||||
* :put r
|
||||
* :put ={expr}
|
||||
@@ -7123,17 +7169,23 @@ compile_put(char_u *arg, exarg_T *eap, cctx_T *cctx)
|
||||
else if (eap->regname != NUL)
|
||||
++line;
|
||||
|
||||
// "errormsg" will not be set because the range is ADDR_LINES.
|
||||
// TODO: if the range contains something like "$" or "." need to evaluate
|
||||
// at runtime
|
||||
if (parse_cmd_address(eap, &errormsg, FALSE) == FAIL)
|
||||
return NULL;
|
||||
if (eap->addr_count == 0)
|
||||
lnum = -1;
|
||||
if (compile_variable_range(eap, cctx) == OK)
|
||||
{
|
||||
lnum = above ? LNUM_VARIABLE_RANGE_ABOVE : LNUM_VARIABLE_RANGE;
|
||||
}
|
||||
else
|
||||
lnum = eap->line2;
|
||||
if (above)
|
||||
--lnum;
|
||||
{
|
||||
// Either no range or a number.
|
||||
// "errormsg" will not be set because the range is ADDR_LINES.
|
||||
if (parse_cmd_address(eap, &errormsg, FALSE) == FAIL)
|
||||
return NULL;
|
||||
if (eap->addr_count == 0)
|
||||
lnum = -1;
|
||||
else
|
||||
lnum = eap->line2;
|
||||
if (above)
|
||||
--lnum;
|
||||
}
|
||||
|
||||
generate_PUT(cctx, eap->regname, lnum);
|
||||
return line;
|
||||
@@ -7542,7 +7594,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
|
||||
|| *ea.cmd == '$'
|
||||
|| *ea.cmd == '@'
|
||||
|| ((len) > 2 && ea.cmd[1] == ':')
|
||||
|| lookup_local(ea.cmd, len, &cctx) != NULL
|
||||
|| lookup_local(ea.cmd, len, NULL, &cctx) == OK
|
||||
|| arg_exists(ea.cmd, len, NULL, NULL,
|
||||
NULL, &cctx) == OK
|
||||
|| script_var_exists(ea.cmd, len,
|
||||
@@ -7595,7 +7647,7 @@ compile_def_function(ufunc_T *ufunc, int set_return_type, cctx_T *outer_cctx)
|
||||
}
|
||||
}
|
||||
p = find_ex_command(&ea, NULL, starts_with_colon ? NULL
|
||||
: (void *(*)(char_u *, size_t, cctx_T *))lookup_local,
|
||||
: (int (*)(char_u *, size_t, void *, cctx_T *))lookup_local,
|
||||
&cctx);
|
||||
|
||||
if (p == ea.cmd && ea.cmdidx != CMD_SIZE)
|
||||
@@ -7960,6 +8012,7 @@ delete_instr(isn_T *isn)
|
||||
case ISN_PUSHEXC:
|
||||
case ISN_PUSHFUNC:
|
||||
case ISN_PUSHS:
|
||||
case ISN_RANGE:
|
||||
case ISN_STOREB:
|
||||
case ISN_STOREENV:
|
||||
case ISN_STOREG:
|
||||
|
||||
@@ -583,7 +583,7 @@ call_bfunc(int func_idx, int argcount, ectx_T *ectx)
|
||||
for (idx = 0; idx < argcount; ++idx)
|
||||
clear_tv(&argvars[idx]);
|
||||
|
||||
if (did_emsg != did_emsg_before)
|
||||
if (did_emsg > did_emsg_before)
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
@@ -2861,6 +2861,26 @@ call_def_function(
|
||||
}
|
||||
break;
|
||||
|
||||
case ISN_RANGE:
|
||||
{
|
||||
exarg_T ea;
|
||||
char *errormsg;
|
||||
|
||||
if (GA_GROW(&ectx.ec_stack, 1) == FAIL)
|
||||
goto failed;
|
||||
++ectx.ec_stack.ga_len;
|
||||
tv = STACK_TV_BOT(-1);
|
||||
ea.addr_type = ADDR_LINES;
|
||||
ea.cmd = iptr->isn_arg.string;
|
||||
if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL)
|
||||
goto failed;
|
||||
if (ea.addr_count == 0)
|
||||
tv->vval.v_number = curwin->w_cursor.lnum;
|
||||
else
|
||||
tv->vval.v_number = ea.line2;
|
||||
}
|
||||
break;
|
||||
|
||||
case ISN_PUT:
|
||||
{
|
||||
int regname = iptr->isn_arg.put.put_regname;
|
||||
@@ -2880,7 +2900,16 @@ call_def_function(
|
||||
}
|
||||
--ectx.ec_stack.ga_len;
|
||||
}
|
||||
if (lnum == -2)
|
||||
if (lnum < -2)
|
||||
{
|
||||
// line number was put on the stack by ISN_RANGE
|
||||
tv = STACK_TV_BOT(-1);
|
||||
curwin->w_cursor.lnum = tv->vval.v_number;
|
||||
if (lnum == LNUM_VARIABLE_RANGE_ABOVE)
|
||||
dir = BACKWARD;
|
||||
--ectx.ec_stack.ga_len;
|
||||
}
|
||||
else if (lnum == -2)
|
||||
// :put! above cursor
|
||||
dir = BACKWARD;
|
||||
else if (lnum >= 0)
|
||||
@@ -3690,8 +3719,18 @@ ex_disassemble(exarg_T *eap)
|
||||
case ISN_2STRING_ANY: smsg("%4d 2STRING_ANY stack[%lld]", current,
|
||||
(long long)(iptr->isn_arg.number));
|
||||
break;
|
||||
case ISN_RANGE: smsg("%4d RANGE %s", current, iptr->isn_arg.string);
|
||||
break;
|
||||
case ISN_PUT:
|
||||
smsg("%4d PUT %c %ld", current, iptr->isn_arg.put.put_regname,
|
||||
if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE_ABOVE)
|
||||
smsg("%4d PUT %c above range",
|
||||
current, iptr->isn_arg.put.put_regname);
|
||||
else if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE)
|
||||
smsg("%4d PUT %c range",
|
||||
current, iptr->isn_arg.put.put_regname);
|
||||
else
|
||||
smsg("%4d PUT %c %ld", current,
|
||||
iptr->isn_arg.put.put_regname,
|
||||
(long)iptr->isn_arg.put.put_lnum);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user