mirror of
https://github.com/zoriya/vim.git
synced 2026-01-05 22:08:16 +00:00
Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df2c2988bb | ||
|
|
97202d9516 | ||
|
|
61015162ba | ||
|
|
1d859e2421 | ||
|
|
5ed58c7b70 | ||
|
|
9a046fd08b | ||
|
|
d697ddea14 | ||
|
|
2e6cdb91e8 | ||
|
|
3e492c2d5f | ||
|
|
bed72df3e6 | ||
|
|
21829c5f2c | ||
|
|
b7e2670b6a | ||
|
|
bb4b93ed85 | ||
|
|
ce0370d9e6 | ||
|
|
98989a0014 | ||
|
|
ff0e57fe77 | ||
|
|
e0e3917554 | ||
|
|
e5ea346a07 | ||
|
|
5c829bf229 | ||
|
|
ab55f11d9b | ||
|
|
c05fe07529 | ||
|
|
4efd994829 | ||
|
|
107e9cecf7 | ||
|
|
ced68a0070 | ||
|
|
8323cab31c | ||
|
|
f002a41d12 | ||
|
|
b204990346 |
5
.github/CODEOWNERS
vendored
5
.github/CODEOWNERS
vendored
@@ -31,6 +31,7 @@ runtime/compiler/dartdevc.vim @dkearns
|
||||
runtime/compiler/dartdoc.vim @dkearns
|
||||
runtime/compiler/dartfmt.vim @dkearns
|
||||
runtime/compiler/eruby.vim @dkearns
|
||||
runtime/compiler/fbc.vim @dkearns
|
||||
runtime/compiler/gawk.vim @dkearns
|
||||
runtime/compiler/gjs.vim @dkearns
|
||||
runtime/compiler/haml.vim @tpope
|
||||
@@ -66,12 +67,14 @@ runtime/doc/pi_tar.txt @cecamp
|
||||
runtime/doc/pi_vimball.txt @cecamp
|
||||
runtime/doc/pi_zip.txt @cecamp
|
||||
runtime/ftplugin/awk.vim @dkearns
|
||||
runtime/ftplugin/basic.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
|
||||
runtime/ftplugin/eruby.vim @tpope @dkearns
|
||||
runtime/ftplugin/freebasic.vim @dkearns
|
||||
runtime/ftplugin/git.vim @tpope
|
||||
runtime/ftplugin/gitcommit.vim @tpope
|
||||
runtime/ftplugin/gitconfig.vim @tpope
|
||||
@@ -93,6 +96,7 @@ runtime/ftplugin/ruby.vim @tpope @dkearns
|
||||
runtime/ftplugin/sass.vim @tpope
|
||||
runtime/ftplugin/scss.vim @tpope
|
||||
runtime/ftplugin/spec.vim @ignatenkobrain
|
||||
runtime/ftplugin/tidy.vim @dkearns
|
||||
runtime/ftplugin/tmux.vim @ericpruitt
|
||||
runtime/ftplugin/typescript.vim @dkearns
|
||||
runtime/ftplugin/typescriptreact.vim @dkearns
|
||||
@@ -127,6 +131,7 @@ runtime/syntax/amiga.vim @cecamp
|
||||
runtime/syntax/asm.vim @dkearns
|
||||
runtime/syntax/asmh8300.vim @dkearns
|
||||
runtime/syntax/awk.vim @dkearns
|
||||
runtime/syntax/basic.vim @dkearns
|
||||
runtime/syntax/bst.vim @tpope
|
||||
runtime/syntax/cabal.vim @coot
|
||||
runtime/syntax/cabalconfig.vim @coot
|
||||
|
||||
27
runtime/compiler/fbc.vim
Normal file
27
runtime/compiler/fbc.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" Vim compiler file
|
||||
" Compiler: FreeBASIC Compiler
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2015 Jan 10
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
let current_compiler = "fbc"
|
||||
|
||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
CompilerSet makeprg=fbc
|
||||
CompilerSet errorformat=%-G%.%#Too\ many\ errors\\,\ exiting,
|
||||
\%f(%l)\ %tarning\ %n(%\\d%\\+):\ %m,
|
||||
\%E%f(%l)\ error\ %n:\ %m,
|
||||
\%-Z%p^,
|
||||
\%-C%.%#,
|
||||
\%-G%.%#
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim compiler file
|
||||
" Compiler: HTML Tidy
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2016 Apr 21
|
||||
" Last Change: 2020 Sep 4
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
@@ -12,8 +12,15 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ %:S
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" foo.html:8:1: Warning: inserting missing 'foobar' element
|
||||
" foo.html:9:2: Error: <foobar> is not recognized!
|
||||
CompilerSet errorformat=%f:%l:%c:\ %trror:%m,%f:%l:%c:\ %tarning:%m,%-G%.%#
|
||||
CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes
|
||||
CompilerSet errorformat=%f:%l:%c:\ %trror:\ %m,
|
||||
\%f:%l:%c:\ %tarning:\ %m,
|
||||
\%f:%l:%c:\ %tnfo:\ %m,
|
||||
\%f:%l:%c:\ %m,
|
||||
\%-G%.%#
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*change.txt* For Vim version 8.2. Last change: 2020 Nov 21
|
||||
*change.txt* For Vim version 8.2. Last change: 2021 Jan 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1631,24 +1631,31 @@ default setting is "tcq". You can separate the option letters with commas for
|
||||
readability.
|
||||
|
||||
letter meaning when present in 'formatoptions' ~
|
||||
|
||||
*fo-t*
|
||||
t Auto-wrap text using textwidth
|
||||
*fo-c*
|
||||
c Auto-wrap comments using textwidth, inserting the current comment
|
||||
leader automatically.
|
||||
*fo-r*
|
||||
r Automatically insert the current comment leader after hitting
|
||||
<Enter> in Insert mode.
|
||||
*fo-o*
|
||||
o Automatically insert the current comment leader after hitting 'o' or
|
||||
'O' in Normal mode.
|
||||
*fo-q*
|
||||
q Allow formatting of comments with "gq".
|
||||
Note that formatting will not change blank lines or lines containing
|
||||
only the comment leader. A new paragraph starts after such a line,
|
||||
or when the comment leader changes.
|
||||
*fo-w*
|
||||
w Trailing white space indicates a paragraph continues in the next line.
|
||||
A line that ends in a non-white character ends a paragraph.
|
||||
*fo-a*
|
||||
a Automatic formatting of paragraphs. Every time text is inserted or
|
||||
deleted the paragraph will be reformatted. See |auto-format|.
|
||||
When the 'c' flag is present this only happens for recognized
|
||||
comments.
|
||||
*fo-n*
|
||||
n When formatting text, recognize numbered lists. This actually uses
|
||||
the 'formatlistpat' option, thus any kind of list can be used. The
|
||||
indent of the text after the number is used for the next line. The
|
||||
@@ -1659,6 +1666,7 @@ n When formatting text, recognize numbered lists. This actually uses
|
||||
1. the first item
|
||||
wraps
|
||||
2. the second item
|
||||
< *fo-2*
|
||||
2 When formatting text, use the indent of the second line of a paragraph
|
||||
for the rest of the paragraph, instead of the indent of the first
|
||||
line. This supports paragraphs in which the first line has a
|
||||
@@ -1668,36 +1676,46 @@ n When formatting text, recognize numbered lists. This actually uses
|
||||
second line of the same paragraph
|
||||
third line.
|
||||
< This also works inside comments, ignoring the comment leader.
|
||||
*fo-v*
|
||||
v Vi-compatible auto-wrapping in insert mode: Only break a line at a
|
||||
blank that you have entered during the current insert command. (Note:
|
||||
this is not 100% Vi compatible. Vi has some "unexpected features" or
|
||||
bugs in this area. It uses the screen column instead of the line
|
||||
column.)
|
||||
*fo-b*
|
||||
b Like 'v', but only auto-wrap if you enter a blank at or before
|
||||
the wrap margin. If the line was longer than 'textwidth' when you
|
||||
started the insert, or you do not enter a blank in the insert before
|
||||
reaching 'textwidth', Vim does not perform auto-wrapping.
|
||||
*fo-l*
|
||||
l Long lines are not broken in insert mode: When a line was longer than
|
||||
'textwidth' when the insert command started, Vim does not
|
||||
automatically format it.
|
||||
*fo-m*
|
||||
m Also break at a multibyte character above 255. This is useful for
|
||||
Asian text where every character is a word on its own.
|
||||
*fo-M*
|
||||
M When joining lines, don't insert a space before or after a multibyte
|
||||
character. Overrules the 'B' flag.
|
||||
*fo-B*
|
||||
B When joining lines, don't insert a space between two multibyte
|
||||
characters. Overruled by the 'M' flag.
|
||||
*fo-1*
|
||||
1 Don't break a line after a one-letter word. It's broken before it
|
||||
instead (if possible).
|
||||
*fo-]*
|
||||
] Respect textwidth rigorously. With this flag set, no line can be
|
||||
longer than textwidth, unless line-break-prohibition rules make this
|
||||
impossible. Mainly for CJK scripts and works only if 'encoding' is
|
||||
"utf-8".
|
||||
*fo-j*
|
||||
j Where it makes sense, remove a comment leader when joining lines. For
|
||||
example, joining:
|
||||
int i; // the index ~
|
||||
// in the list ~
|
||||
Becomes:
|
||||
int i; // the index in the list ~
|
||||
*fo-p*
|
||||
p Don't break lines at single spaces that follow periods. This is
|
||||
intended to complement 'joinspaces' and |cpo-J|, for prose with
|
||||
sentences separated by two spaces. For example, with 'textwidth' set
|
||||
|
||||
@@ -1096,7 +1096,7 @@ Also see |`=|.
|
||||
In the command-line window the command line can be edited just like editing
|
||||
text in any window. It is a special kind of window, because you cannot leave
|
||||
it in a normal way.
|
||||
{not available when compiled without the |+cmdline_hist| feature}
|
||||
{not available when compiled without the |+cmdwin| feature}
|
||||
|
||||
|
||||
OPEN *c_CTRL-F* *q:* *q/* *q?*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 8.2. Last change: 2021 Jan 21
|
||||
*eval.txt* For Vim version 8.2. Last change: 2021 Jan 22
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -2085,7 +2085,7 @@ v:null An empty String. Used to put "null" in JSON. See
|
||||
*v:numbermax* *numbermax-variable*
|
||||
v:numbermax Maximum value of a number.
|
||||
|
||||
*v:numbermix* *numbermix-variable*
|
||||
*v:numbermin* *numbermin-variable*
|
||||
v:numbermin Minimum value of a number (negative)
|
||||
|
||||
*v:numbersize* *numbersize-variable*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*filetype.txt* For Vim version 8.2. Last change: 2020 Sep 28
|
||||
*filetype.txt* For Vim version 8.2. Last change: 2021 Jan 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*popup.txt* For Vim version 8.2. Last change: 2020 Nov 07
|
||||
*popup.txt* For Vim version 8.2. Last change: 2021 Jan 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*repeat.txt* For Vim version 8.2. Last change: 2021 Jan 02
|
||||
*repeat.txt* For Vim version 8.2. Last change: 2021 Jan 23
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -354,7 +354,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
Vim version, or update Vim to a newer version. See
|
||||
|vimscript-version| for what changed between versions.
|
||||
|
||||
:vim9script [noclear] *:vim9* *:vim9script*
|
||||
:vim9[script] [noclear] *:vim9* *:vim9script*
|
||||
Marks a script file as containing |Vim9-script|
|
||||
commands. Also see |vim9-namespace|.
|
||||
Must be the first command in the file.
|
||||
@@ -899,8 +899,9 @@ matches ".../plugin/explorer.vim", ".../plugin/iexplorer.vim", etc. >
|
||||
matches ".../plugin/explorer.vim" and "explorer.vim" in any other directory.
|
||||
|
||||
The match for functions is done against the name as it's shown in the output
|
||||
of ":function". For local functions this means that something like "<SNR>99_"
|
||||
is prepended.
|
||||
of ":function". However, for local functions the script-specific prefix such
|
||||
as "<SNR>99_" is ignored to make it easier to match script-local functions
|
||||
without knowing the ID of the script.
|
||||
|
||||
Note that functions are first loaded and later executed. When they are loaded
|
||||
the "file" breakpoints are checked, when they are executed the "func"
|
||||
@@ -955,10 +956,10 @@ OBSCURE
|
||||
|
||||
Profiling means that Vim measures the time that is spent on executing
|
||||
functions and/or scripts. The |+profile| feature is required for this.
|
||||
It is only included when Vim was compiled with "huge" features.
|
||||
It is included when Vim was compiled with "huge" features.
|
||||
|
||||
You can also use the |reltime()| function to measure time. This only requires
|
||||
the |+reltime| feature, which is present more often.
|
||||
the |+reltime| feature, which is present in more builds.
|
||||
|
||||
For profiling syntax highlighting see |:syntime|.
|
||||
|
||||
@@ -1005,7 +1006,12 @@ For example, to profile the one_script.vim script file: >
|
||||
|
||||
|
||||
You must always start with a ":profile start fname" command. The resulting
|
||||
file is written when Vim exits. Here is an example of the output, with line
|
||||
file is written when Vim exits. For example, to profile one specific
|
||||
function: >
|
||||
profile start /tmp/vimprofile
|
||||
profile func MyFunc
|
||||
|
||||
Here is an example of the output, with line
|
||||
numbers prepended for the explanation:
|
||||
|
||||
1 FUNCTION Test2() ~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*syntax.txt* For Vim version 8.2. Last change: 2020 Dec 17
|
||||
*syntax.txt* For Vim version 8.2. Last change: 2021 Jan 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
@@ -6431,7 +6431,26 @@ fname_new-variable eval.txt /*fname_new-variable*
|
||||
fname_out-variable eval.txt /*fname_out-variable*
|
||||
fnameescape() eval.txt /*fnameescape()*
|
||||
fnamemodify() eval.txt /*fnamemodify()*
|
||||
fo-1 change.txt /*fo-1*
|
||||
fo-2 change.txt /*fo-2*
|
||||
fo-B change.txt /*fo-B*
|
||||
fo-M change.txt /*fo-M*
|
||||
fo-] change.txt /*fo-]*
|
||||
fo-a change.txt /*fo-a*
|
||||
fo-b change.txt /*fo-b*
|
||||
fo-c change.txt /*fo-c*
|
||||
fo-j change.txt /*fo-j*
|
||||
fo-l change.txt /*fo-l*
|
||||
fo-m change.txt /*fo-m*
|
||||
fo-n change.txt /*fo-n*
|
||||
fo-o change.txt /*fo-o*
|
||||
fo-p change.txt /*fo-p*
|
||||
fo-q change.txt /*fo-q*
|
||||
fo-r change.txt /*fo-r*
|
||||
fo-t change.txt /*fo-t*
|
||||
fo-table change.txt /*fo-table*
|
||||
fo-v change.txt /*fo-v*
|
||||
fo-w change.txt /*fo-w*
|
||||
fold-behavior fold.txt /*fold-behavior*
|
||||
fold-colors fold.txt /*fold-colors*
|
||||
fold-commands fold.txt /*fold-commands*
|
||||
@@ -8271,6 +8290,8 @@ null vim9.txt /*null*
|
||||
null-variable eval.txt /*null-variable*
|
||||
number_relativenumber options.txt /*number_relativenumber*
|
||||
numbered-function eval.txt /*numbered-function*
|
||||
numbermax-variable eval.txt /*numbermax-variable*
|
||||
numbermin-variable eval.txt /*numbermin-variable*
|
||||
numbersize-variable eval.txt /*numbersize-variable*
|
||||
o insert.txt /*o*
|
||||
o_CTRL-V motion.txt /*o_CTRL-V*
|
||||
@@ -9847,6 +9868,8 @@ v:mouse_win eval.txt /*v:mouse_win*
|
||||
v:mouse_winid eval.txt /*v:mouse_winid*
|
||||
v:none eval.txt /*v:none*
|
||||
v:null eval.txt /*v:null*
|
||||
v:numbermax eval.txt /*v:numbermax*
|
||||
v:numbermin eval.txt /*v:numbermin*
|
||||
v:numbersize eval.txt /*v:numbersize*
|
||||
v:oldfiles eval.txt /*v:oldfiles*
|
||||
v:operator eval.txt /*v:operator*
|
||||
@@ -10089,6 +10112,7 @@ vim8 version8.txt /*vim8*
|
||||
vim9 vim9.txt /*vim9*
|
||||
vim9-classes vim9.txt /*vim9-classes*
|
||||
vim9-const vim9.txt /*vim9-const*
|
||||
vim9-curly vim9.txt /*vim9-curly*
|
||||
vim9-declaration vim9.txt /*vim9-declaration*
|
||||
vim9-declarations usr_46.txt /*vim9-declarations*
|
||||
vim9-differences vim9.txt /*vim9-differences*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 8.2. Last change: 2021 Jan 17
|
||||
*todo.txt* For Vim version 8.2. Last change: 2021 Jan 25
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -41,6 +41,7 @@ browser use: https://github.com/vim/vim/issues/1234
|
||||
test_autocmd failure in Windows: Something wrong with system()?
|
||||
|
||||
Vim9 - Make everything work:
|
||||
- Add a test for profiling with nested function calls and lambda.
|
||||
- Expand `=expr` in :next, :argedit, :argadd, :argdelete, :drop
|
||||
- Expand `=expr` in :vimgrep, :vimgrepadd, :lvimgrep, :lvimgrepadd
|
||||
- Expand `=expr` in :mkspell
|
||||
@@ -50,7 +51,7 @@ Vim9 - Make everything work:
|
||||
- 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')
|
||||
var p = function('NoSuchFunc')
|
||||
- Make closures work better:
|
||||
- Create closure in a loop. Need to make a list of them.
|
||||
- If a :def function is called with a function reference, compile it to get
|
||||
@@ -58,20 +59,16 @@ Vim9 - Make everything work:
|
||||
def Filter(x: string, Cond: func(string): bool)
|
||||
Filter(x, (v) => v =~ '^b')
|
||||
- Make inline function work, to be used as a funcref:
|
||||
let Ref = (arg: type): type => {
|
||||
var Ref = (arg: type): type => {
|
||||
statement
|
||||
return expr
|
||||
}
|
||||
let Ref = (arg: type) => {
|
||||
var Ref = (arg: type) => {
|
||||
statement
|
||||
statement
|
||||
}
|
||||
- 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.
|
||||
- Possible memory leaks in test_vim9_func
|
||||
- Implement :lockvar and :unlockvar. How about local variables? Perhaps only
|
||||
allow this for global variables. Use :final or :const otherwise.
|
||||
- Allow function names that will be script-local to start with lower case
|
||||
@@ -86,10 +83,10 @@ Vim9 - Make everything work:
|
||||
- Need the equivalent of get_lval() and set_var_lval() to implement assignment
|
||||
to nested list and dict members.
|
||||
- Assignment to dict doesn't work:
|
||||
let ret: dict<string> = #{}
|
||||
var ret: dict<string> = #{}
|
||||
ret[i] = string(i)
|
||||
- Appending to dict item doesn't work:
|
||||
let d[i] ..= value
|
||||
var d[i] ..= value
|
||||
- Using ".." at script level doesn't convert arguments to a string.
|
||||
- Compile replacement of :s command: s/pat/\=expr/
|
||||
- Compile redir to local variable: var_redir_start().
|
||||
@@ -144,7 +141,6 @@ Also for Vim9:
|
||||
- Make debugging work - at least per function. Need to recompile a function
|
||||
to step through it line-by-line? Evaluate the stack and variables on the
|
||||
stack?
|
||||
- Make profiling work - Add ISN_PROFILE instructions after every line?
|
||||
- List commands when 'verbose' is set or :verbose is used.
|
||||
|
||||
Further Vim9 improvements, possibly after launch:
|
||||
@@ -187,6 +183,10 @@ Popup windows:
|
||||
- Figure out the size and position better if wrapping inserts indent
|
||||
|
||||
Text properties:
|
||||
- Popup attached to text property stays visible when text is no longer
|
||||
visible. (#7736)
|
||||
- Popup attached to text property stays visible when text is deleted with
|
||||
"cc". (#7737) "C" works OK.
|
||||
- :goto does not go to the right place when text properties are present.
|
||||
(#5930)
|
||||
- "cc" does not call inserted_bytes(). (Axel Forsman, #5763)
|
||||
@@ -282,7 +282,7 @@ Patch to implement the vimtutor with a plugin: #6414
|
||||
Was originally written by Felipe Morales.
|
||||
|
||||
Adding "10" to 'spellsuggest' causes spell suggestions to become very slow.
|
||||
(#4087)
|
||||
(#4087) Did patch 8.2.2379 help?
|
||||
|
||||
Patch to find Python dll using registry key. (#7540)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*vi_diff.txt* For Vim version 8.2. Last change: 2020 Aug 15
|
||||
*vi_diff.txt* For Vim version 8.2. Last change: 2021 Jan 21
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2021 Jan 15
|
||||
*vim9.txt* For Vim version 8.2. Last change: 2021 Jan 23
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -403,10 +403,16 @@ Additionally, a lambda can contain statements in {}: >
|
||||
}
|
||||
NOT IMPLEMENTED YET
|
||||
|
||||
*vim9-curly*
|
||||
To avoid the "{" of a dictionary literal to be recognized as a statement block
|
||||
wrap it in parenthesis: >
|
||||
var Lambda = (arg) => ({key: 42})
|
||||
|
||||
Also when confused with the start of a command block: >
|
||||
({
|
||||
key: value
|
||||
})->method()
|
||||
|
||||
|
||||
Automatic line continuation ~
|
||||
|
||||
@@ -841,6 +847,9 @@ prefix and they do not need to exist (they can be deleted any time).
|
||||
Note that for command line completion of {func} you
|
||||
can prepend "s:" to find script-local functions.
|
||||
|
||||
:disa[ssemble]! {func} Like `:disassemble` but with the instructions used for
|
||||
profiling.
|
||||
|
||||
Limitations ~
|
||||
|
||||
Local variables will not be visible to string evaluation. For example: >
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2020 Dec 24
|
||||
" Last Change: 2021 Jan 21
|
||||
|
||||
" Listen very carefully, I will say this only once
|
||||
if exists("did_load_filetypes")
|
||||
@@ -1176,9 +1176,10 @@ au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
|
||||
" Password file
|
||||
au BufNewFile,BufRead */etc/passwd,*/etc/passwd-,*/etc/passwd.edit,*/etc/shadow,*/etc/shadow-,*/etc/shadow.edit,*/var/backups/passwd.bak,*/var/backups/shadow.bak setf passwd
|
||||
|
||||
" Pascal (also *.p)
|
||||
" Pascal (also *.p, *.pp, *.inc)
|
||||
au BufNewFile,BufRead *.pas setf pascal
|
||||
|
||||
" Pascal or Puppet manifest
|
||||
au BufNewFile,BufRead *.pp call dist#ft#FTpp()
|
||||
|
||||
" Delphi or Lazarus program file
|
||||
@@ -1269,7 +1270,7 @@ au BufNewFile,BufRead *.pov setf pov
|
||||
" Povray configuration
|
||||
au BufNewFile,BufRead .povrayrc setf povini
|
||||
|
||||
" Povray, PHP or assembly
|
||||
" Povray, Pascal, PHP or assembly
|
||||
au BufNewFile,BufRead *.inc call dist#ft#FTinc()
|
||||
|
||||
" Printcap and Termcap
|
||||
@@ -1278,13 +1279,19 @@ au BufNewFile,BufRead *printcap
|
||||
au BufNewFile,BufRead *termcap
|
||||
\ let b:ptcap_type = "term" | setf ptcap
|
||||
|
||||
" PCCTS / ANTRL
|
||||
"au BufNewFile,BufRead *.g setf antrl
|
||||
" PCCTS / ANTLR
|
||||
"au BufNewFile,BufRead *.g setf antlr
|
||||
au BufNewFile,BufRead *.g setf pccts
|
||||
|
||||
" PPWizard
|
||||
au BufNewFile,BufRead *.it,*.ih setf ppwiz
|
||||
|
||||
" Puppet
|
||||
au BufNewFile,BufRead Puppetfile setf ruby
|
||||
|
||||
" Embedded Puppet
|
||||
au BufNewFile,BufRead *.epp setf epuppet
|
||||
|
||||
" Obj 3D file format
|
||||
" TODO: is there a way to avoid MS-Windows Object files?
|
||||
au BufNewFile,BufRead *.obj setf obj
|
||||
@@ -1427,8 +1434,8 @@ au BufNewFile,BufRead *.rb,*.rbw setf ruby
|
||||
" RubyGems
|
||||
au BufNewFile,BufRead *.gemspec setf ruby
|
||||
|
||||
" Rust
|
||||
au BufNewFile,BufRead *.rs setf rust
|
||||
" RBS (Ruby Signature)
|
||||
au BufNewFile,BufRead *.rbs setf rbs
|
||||
|
||||
" Rackup
|
||||
au BufNewFile,BufRead *.ru setf ruby
|
||||
@@ -1442,6 +1449,9 @@ au BufNewFile,BufRead *.builder,*.rxml,*.rjs setf ruby
|
||||
" Rantfile and Rakefile is like Ruby
|
||||
au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake setf ruby
|
||||
|
||||
" Rust
|
||||
au BufNewFile,BufRead *.rs setf rust
|
||||
|
||||
" S-lang (or shader language, or SmallLisp)
|
||||
au BufNewFile,BufRead *.sl setf slang
|
||||
|
||||
|
||||
@@ -159,40 +159,41 @@ if exists("g:ada_abbrev")
|
||||
endif
|
||||
|
||||
" Section: Commands, Mapping, Menus {{{1
|
||||
"
|
||||
call ada#Map_Popup (
|
||||
\ 'Tag.List',
|
||||
\ 'l',
|
||||
\ 'call ada#List_Tag ()')
|
||||
call ada#Map_Popup (
|
||||
\'Tag.Jump',
|
||||
\'j',
|
||||
\'call ada#Jump_Tag ()')
|
||||
call ada#Map_Menu (
|
||||
\'Tag.Create File',
|
||||
\':AdaTagFile',
|
||||
\'call ada#Create_Tags (''file'')')
|
||||
call ada#Map_Menu (
|
||||
\'Tag.Create Dir',
|
||||
\':AdaTagDir',
|
||||
\'call ada#Create_Tags (''dir'')')
|
||||
if !exists(':AdaTagFile')
|
||||
call ada#Map_Popup (
|
||||
\ 'Tag.List',
|
||||
\ 'l',
|
||||
\ 'call ada#List_Tag ()')
|
||||
call ada#Map_Popup (
|
||||
\'Tag.Jump',
|
||||
\'j',
|
||||
\'call ada#Jump_Tag ()')
|
||||
call ada#Map_Menu (
|
||||
\'Tag.Create File',
|
||||
\':AdaTagFile',
|
||||
\'call ada#Create_Tags (''file'')')
|
||||
call ada#Map_Menu (
|
||||
\'Tag.Create Dir',
|
||||
\':AdaTagDir',
|
||||
\'call ada#Create_Tags (''dir'')')
|
||||
|
||||
call ada#Map_Menu (
|
||||
\'Highlight.Toggle Space Errors',
|
||||
\ ':AdaSpaces',
|
||||
\'call ada#Switch_Syntax_Option (''space_errors'')')
|
||||
call ada#Map_Menu (
|
||||
\'Highlight.Toggle Lines Errors',
|
||||
\ ':AdaLines',
|
||||
\'call ada#Switch_Syntax_Option (''line_errors'')')
|
||||
call ada#Map_Menu (
|
||||
\'Highlight.Toggle Rainbow Color',
|
||||
\ ':AdaRainbow',
|
||||
\'call ada#Switch_Syntax_Option (''rainbow_color'')')
|
||||
call ada#Map_Menu (
|
||||
\'Highlight.Toggle Standard Types',
|
||||
\ ':AdaTypes',
|
||||
\'call ada#Switch_Syntax_Option (''standard_types'')')
|
||||
call ada#Map_Menu (
|
||||
\'Highlight.Toggle Space Errors',
|
||||
\ ':AdaSpaces',
|
||||
\'call ada#Switch_Syntax_Option (''space_errors'')')
|
||||
call ada#Map_Menu (
|
||||
\'Highlight.Toggle Lines Errors',
|
||||
\ ':AdaLines',
|
||||
\'call ada#Switch_Syntax_Option (''line_errors'')')
|
||||
call ada#Map_Menu (
|
||||
\'Highlight.Toggle Rainbow Color',
|
||||
\ ':AdaRainbow',
|
||||
\'call ada#Switch_Syntax_Option (''rainbow_color'')')
|
||||
call ada#Map_Menu (
|
||||
\'Highlight.Toggle Standard Types',
|
||||
\ ':AdaTypes',
|
||||
\'call ada#Switch_Syntax_Option (''standard_types'')')
|
||||
endif
|
||||
|
||||
" 1}}}
|
||||
" Reset cpoptions
|
||||
|
||||
27
runtime/ftplugin/basic.vim
Normal file
27
runtime/ftplugin/basic.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: BASIC
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2015 Jan 10
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal comments=:REM,:'
|
||||
setlocal commentstring='\ %s
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin = "setl fo< com< cms< sua<" .
|
||||
\ " | unlet! b:browsefilter"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Bazel (http://bazel.io)
|
||||
" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl)
|
||||
" Last Change: 2015 Aug 11
|
||||
" Last Change: 2021 Jan 19
|
||||
|
||||
""
|
||||
" @section Introduction, intro
|
||||
@@ -51,6 +51,8 @@ if get(g:, 'ft_bzl_fold', 0)
|
||||
endif
|
||||
|
||||
if exists('*BzlFoldText')
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2008-07-19
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let b:undo_ftplugin = "setl com< cms< fo< inc< | unlet! b:matchwords"
|
||||
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,:// commentstring=/*\ %s\ */
|
||||
|
||||
13
runtime/ftplugin/freebasic.vim
Normal file
13
runtime/ftplugin/freebasic.vim
Normal file
@@ -0,0 +1,13 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: FreeBasic
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2015 Jan 10
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
runtime! ftplugin/basic.vim
|
||||
|
||||
" vim: ts=8
|
||||
@@ -2,7 +2,7 @@
|
||||
" Language: Hamster Script
|
||||
" Version: 2.0.6.0
|
||||
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
|
||||
" Last Change: 2017 Mar 18
|
||||
" Last Change: 2021 Jan 19
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
@@ -57,6 +57,9 @@ if exists("loaded_matchit")
|
||||
endif
|
||||
|
||||
setlocal ignorecase
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
setlocal cpo+=M " makes \%( match \)
|
||||
|
||||
" Disabled, 'cpo' is a global option.
|
||||
" setlocal cpo+=M " makes \%( match \)
|
||||
|
||||
@@ -159,6 +159,8 @@ let b:undo_ftplugin = "setlocal efm< foldmethod< foldexpr<"
|
||||
" - Only definitions below, executed once -------------------------------------
|
||||
|
||||
if exists("*OMLetFoldLevel")
|
||||
let &cpoptions = s:cposet
|
||||
unlet s:cposet
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -635,7 +637,7 @@ endfunction
|
||||
nnoremap <silent> <Plug>OCamlPrintType :<C-U>call Ocaml_print_type("normal")<CR>
|
||||
xnoremap <silent> <Plug>OCamlPrintType :<C-U>call Ocaml_print_type("visual")<CR>`<
|
||||
|
||||
let &cpoptions=s:cposet
|
||||
let &cpoptions = s:cposet
|
||||
unlet s:cposet
|
||||
|
||||
" vim:sw=2 fdm=indent
|
||||
|
||||
32
runtime/ftplugin/tidy.vim
Normal file
32
runtime/ftplugin/tidy.vim
Normal file
@@ -0,0 +1,32 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: HMTL Tidy Configuration
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2020 Sep 4
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal comments=:#,://
|
||||
setlocal commentstring=#\ %s
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
let b:browsefilter = "HTML Tidy Files (tidyrc, .tidyrc, tidy.conf)\ttidyrc;.tidyrc;tidy.conf\n" .
|
||||
\ "HTML Files (*.html, *.htm)\t*.html;*.htm\n" .
|
||||
\ "XHTML Files (*.xhtml, *.xhtm)\t*.xhtml;*.xhtm\n" .
|
||||
\ "XML Files (*.xml)\t*.xml\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin = "setl fo< com< cms<" .
|
||||
\ " | unlet! b:browsefilter"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Vim
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2021 Jan 12
|
||||
" Last Change: 2021 Jan 23
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
@@ -88,8 +88,13 @@ endif
|
||||
" Let the matchit plugin know what items can be matched.
|
||||
if exists("loaded_matchit")
|
||||
let b:match_ignorecase = 0
|
||||
" "func" can also be used as a type:
|
||||
" var Ref: func
|
||||
" or to list functions:
|
||||
" func name
|
||||
" require a parenthesis following, then there can be an "endfunc".
|
||||
let b:match_words =
|
||||
\ '\<\%(fu\%[nction]\|def\)\>)\@!:\<retu\%[rn]\>:\<\%(endf\%[unction]\|enddef\)\>,' .
|
||||
\ '\<\%(fu\%[nction]\|def\)\s\+\S\+(:\<retu\%[rn]\>:\<\%(endf\%[unction]\|enddef\)\>,' .
|
||||
\ '\<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' .
|
||||
\ '\<if\>:\<el\%[seif]\>:\<en\%[dif]\>,' .
|
||||
\ '{:},' .
|
||||
|
||||
@@ -74,11 +74,15 @@ endif
|
||||
if (b:fortran_fixed_source == 1)
|
||||
setlocal indentexpr=FortranGetFixedIndent()
|
||||
if exists("*FortranGetFixedIndent")
|
||||
let &cpoptions = s:cposet
|
||||
unlet s:cposet
|
||||
finish
|
||||
endif
|
||||
else
|
||||
setlocal indentexpr=FortranGetFreeIndent()
|
||||
if exists("*FortranGetFreeIndent")
|
||||
let &cpoptions = s:cposet
|
||||
unlet s:cposet
|
||||
finish
|
||||
endif
|
||||
endif
|
||||
@@ -213,7 +217,7 @@ function FortranGetFixedIndent()
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
let &cpoptions=s:cposet
|
||||
let &cpoptions = s:cposet
|
||||
unlet s:cposet
|
||||
|
||||
" vim:sw=2 tw=130
|
||||
|
||||
@@ -10,6 +10,11 @@ let cmd =
|
||||
\ 'some '
|
||||
\ 'string'
|
||||
|
||||
if 1
|
||||
let x = [
|
||||
\ ]
|
||||
endif
|
||||
|
||||
" END_INDENT
|
||||
|
||||
" START_INDENT
|
||||
|
||||
@@ -10,6 +10,11 @@ let cmd =
|
||||
\ 'some '
|
||||
\ 'string'
|
||||
|
||||
if 1
|
||||
let x = [
|
||||
\ ]
|
||||
endif
|
||||
|
||||
" END_INDENT
|
||||
|
||||
" START_INDENT
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim indent file
|
||||
" Language: Vim script
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2021 Jan 06
|
||||
" Last Change: 2021 Jan 21
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists("b:did_indent")
|
||||
@@ -38,6 +38,9 @@ function GetVimIndentIntern()
|
||||
" Find a non-blank line above the current line.
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
|
||||
" The previous line, ignoring line continuation
|
||||
let prev_text_end = lnum > 0 ? getline(lnum) : ''
|
||||
|
||||
" If the current line doesn't start with '\' or '"\ ' and below a line that
|
||||
" starts with '\' or '"\ ', use the indent of the line above it.
|
||||
let cur_text = getline(v:lnum)
|
||||
@@ -51,6 +54,8 @@ function GetVimIndentIntern()
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" the start of the previous line, skipping over line continuation
|
||||
let prev_text = getline(lnum)
|
||||
let found_cont = 0
|
||||
|
||||
@@ -147,13 +152,13 @@ function GetVimIndentIntern()
|
||||
endif
|
||||
|
||||
" Below a line starting with "]" we must be below the end of a list.
|
||||
if prev_text =~ '^\s*]'
|
||||
if prev_text_end =~ '^\s*]'
|
||||
let ind = ind - shiftwidth()
|
||||
endif
|
||||
|
||||
" A line ending in "{"/"[} is most likely the start of a dict/list literal,
|
||||
" indent the next line more. Not for a continuation line.
|
||||
if prev_text =~ '[{[]\s*$' && !found_cont
|
||||
if prev_text_end =~ '[{[]\s*$' && !found_cont
|
||||
let ind = ind + shiftwidth()
|
||||
endif
|
||||
|
||||
|
||||
@@ -2,16 +2,13 @@
|
||||
" Language: YAML
|
||||
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
|
||||
" Last Update: Lukas Reineke
|
||||
" Last Change: 2020 Jun 07
|
||||
" Last Change: 2021 Jan 19
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetYAMLIndent(v:lnum)
|
||||
@@ -25,6 +22,9 @@ if exists('*GetYAMLIndent')
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function s:FindPrevLessIndentedLine(lnum, ...)
|
||||
let prevlnum = prevnonblank(a:lnum-1)
|
||||
let curindent = a:0 ? a:1 : indent(a:lnum)
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
" Vim syntax file
|
||||
" Language: BASIC
|
||||
" Maintainer: Allan Kelly <allan@fruitloaf.co.uk>
|
||||
" Last Change: 2011 Dec 25 by Thilo Six
|
||||
" Language: BASIC
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Previous Maintainer: Allan Kelly <allan@fruitloaf.co.uk>
|
||||
" Contributors: Thilo Six
|
||||
" Last Change: 2015 Jan 10
|
||||
|
||||
" First version based on Micro$soft QBASIC circa 1989, as documented in
|
||||
" 'Learn BASIC Now' by Halvorson&Rygmyr. Microsoft Press 1989.
|
||||
" This syntax file not a complete implementation yet. Send suggestions to the
|
||||
" maintainer.
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
" Prelude {{{1
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
@@ -16,7 +18,7 @@ endif
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" A bunch of useful BASIC keywords
|
||||
" Keywords {{{1
|
||||
syn keyword basicStatement BEEP beep Beep BLOAD bload Bload BSAVE bsave Bsave
|
||||
syn keyword basicStatement CALL call Call ABSOLUTE absolute Absolute
|
||||
syn keyword basicStatement CHAIN chain Chain CHDIR chdir Chdir
|
||||
@@ -116,32 +118,39 @@ syn keyword basicFunction RIGHT$ right$ Right$ RTRIM$ rtrim$ Rtrim$
|
||||
syn keyword basicFunction SPACE$ space$ Space$ STR$ str$ Str$
|
||||
syn keyword basicFunction STRING$ string$ String$ TIME$ time$ Time$
|
||||
syn keyword basicFunction UCASE$ ucase$ Ucase$ VARPTR$ varptr$ Varptr$
|
||||
syn keyword basicTodo contained TODO
|
||||
|
||||
"integer number, or floating point number without a dot.
|
||||
" Numbers {{{1
|
||||
" Integer number, or floating point number without a dot.
|
||||
syn match basicNumber "\<\d\+\>"
|
||||
"floating point number, with dot
|
||||
" Floating point number, with dot
|
||||
syn match basicNumber "\<\d\+\.\d*\>"
|
||||
"floating point number, starting with a dot
|
||||
" Floating point number, starting with a dot
|
||||
syn match basicNumber "\.\d\+\>"
|
||||
|
||||
" String and Character contstants
|
||||
syn match basicSpecial contained "\\\d\d\d\|\\."
|
||||
syn region basicString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=basicSpecial
|
||||
" String and Character constants {{{1
|
||||
syn match basicSpecial "\\\d\d\d\|\\." contained
|
||||
syn region basicString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=basicSpecial
|
||||
|
||||
syn region basicComment start="REM" end="$" contains=basicTodo
|
||||
syn region basicComment start="^[ \t]*'" end="$" contains=basicTodo
|
||||
" Line numbers {{{1
|
||||
syn region basicLineNumber start="^\d" end="\s"
|
||||
syn match basicTypeSpecifier "[a-zA-Z0-9][\$%&!#]"ms=s+1
|
||||
|
||||
" Data-type suffixes {{{1
|
||||
syn match basicTypeSpecifier "[a-zA-Z0-9][$%&!#]"ms=s+1
|
||||
" Used with OPEN statement
|
||||
syn match basicFilenumber "#\d\+"
|
||||
"syn sync ccomment basicComment
|
||||
|
||||
" Mathematical operators {{{1
|
||||
" syn match basicMathsOperator "[<>+\*^/\\=-]"
|
||||
syn match basicMathsOperator "-\|=\|[:<>+\*^/\\]\|AND\|OR"
|
||||
syn match basicMathsOperator "-\|=\|[:<>+\*^/\\]\|AND\|OR"
|
||||
|
||||
" Define the default highlighting.
|
||||
" Only when an item doesn't have highlighting yet
|
||||
" Comments {{{1
|
||||
syn keyword basicTodo TODO FIXME XXX NOTE contained
|
||||
syn region basicComment start="^\s*\zsREM\>" start="\%(:\s*\)\@<=REM\>" end="$" contains=basicTodo
|
||||
syn region basicComment start="'" end="$" contains=basicTodo
|
||||
|
||||
"syn sync ccomment basicComment
|
||||
|
||||
" Default Highlighting {{{1
|
||||
hi def link basicLabel Label
|
||||
hi def link basicConditional Conditional
|
||||
hi def link basicRepeat Repeat
|
||||
@@ -150,17 +159,18 @@ hi def link basicNumber Number
|
||||
hi def link basicError Error
|
||||
hi def link basicStatement Statement
|
||||
hi def link basicString String
|
||||
hi def link basicComment Comment
|
||||
hi def link basicSpecial Special
|
||||
hi def link basicComment Comment
|
||||
hi def link basicSpecial Special
|
||||
hi def link basicTodo Todo
|
||||
hi def link basicFunction Identifier
|
||||
hi def link basicTypeSpecifier Type
|
||||
hi def link basicFilenumber basicTypeSpecifier
|
||||
hi def link basicFunction Identifier
|
||||
hi def link basicTypeSpecifier Type
|
||||
hi def link basicFilenumber basicTypeSpecifier
|
||||
"hi basicMathsOperator term=bold cterm=bold gui=bold
|
||||
|
||||
|
||||
" Postscript {{{1
|
||||
let b:current_syntax = "basic"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
" vim: ts=8
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
" Vim syntax file
|
||||
" Language: HMTL Tidy configuration file (/etc/tidyrc ~/.tidyrc)
|
||||
" Language: HMTL Tidy Configuration
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2016 Apr 24
|
||||
" Last Change: 2020 Sep 4
|
||||
|
||||
" Preamble {{{1
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
@@ -12,10 +13,15 @@ set cpo&vim
|
||||
|
||||
syn iskeyword @,48-57,-,_
|
||||
|
||||
" Values {{{1
|
||||
syn match tidyWordSeparator contained ",\|\s" nextgroup=tidyWord skipwhite skipnl
|
||||
syn match tidyMuteIDSeparator contained ",\|\s" nextgroup=tidyMuteID skipwhite skipnl
|
||||
|
||||
syn case ignore
|
||||
syn keyword tidyBoolean contained t[rue] f[alse] y[es] n[o] 1 0
|
||||
syn keyword tidyAutoBoolean contained t[rue] f[alse] y[es] n[o] 1 0 auto
|
||||
syn case match
|
||||
syn keyword tidyCustomTags contained no blocklevel empty inline pre
|
||||
syn keyword tidyDoctype contained html5 omit auto strict loose transitional user
|
||||
syn keyword tidyEncoding contained raw ascii latin0 latin1 utf8 iso2022 mac win1252 ibm858 utf16le utf16be utf16 big5 shiftjis
|
||||
syn keyword tidyNewline contained LF CRLF CR
|
||||
@@ -24,36 +30,148 @@ syn keyword tidyRepeat contained keep-first keep-last
|
||||
syn keyword tidySorter contained alpha none
|
||||
syn region tidyString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ oneline
|
||||
syn region tidyString contained start=+'+ skip=+\\\\\|\\'+ end=+'+ oneline
|
||||
syn match tidyTags contained "\<\w\+\(\s*,\s*\w\+\)*\>"
|
||||
" Tag and attribute lists
|
||||
syn match tidyWord contained "\<\k\+\>:\@!" nextgroup=tidyWordSeparator skipwhite skipnl
|
||||
|
||||
syn keyword tidyBooleanOption add-xml-decl add-xml-pi add-xml-space
|
||||
\ anchor-as-name ascii-chars assume-xml-procins bare break-before-br
|
||||
\ clean coerce-endtags decorate-inferred-ul drop-empty-paras
|
||||
\ drop-empty-elements drop-font-tags drop-proprietary-attributes
|
||||
\ enclose-block-text enclose-text escape-cdata escape-scripts
|
||||
\ fix-backslash fix-bad-comments fix-uri force-output gdoc gnu-emacs
|
||||
\ hide-comments hide-endtags indent-attributes indent-cdata
|
||||
\ indent-with-tabs input-xml join-classes join-styles keep-time
|
||||
\ language literal-attributes logical-emphasis lower-literals markup
|
||||
\ merge-emphasis ncr numeric-entities omit-optional-tags output-html
|
||||
\ output-xhtml output-xml preserve-entities punctuation-wrap quiet
|
||||
\ quote-ampersand quote-marks quote-nbsp raw replace-color show-info
|
||||
\ show-warnings skip-nested split strict-tags-attributes tidy-mark
|
||||
\ uppercase-attributes uppercase-tags word-2000 wrap-asp
|
||||
\ wrap-attributes wrap-jste wrap-php wrap-script-literals
|
||||
\ wrap-sections write-back
|
||||
" Mute Message IDs {{{2
|
||||
syn keyword tidyMuteID ADDED_MISSING_CHARSET ANCHOR_DUPLICATED
|
||||
\ ANCHOR_NOT_UNIQUE APOS_UNDEFINED APPLET_MISSING_ALT AREA_MISSING_ALT
|
||||
\ ASCII_REQUIRES_DESCRIPTION ASSOCIATE_LABELS_EXPLICITLY
|
||||
\ ASSOCIATE_LABELS_EXPLICITLY_FOR ASSOCIATE_LABELS_EXPLICITLY_ID
|
||||
\ ATTRIBUTE_IS_NOT_ALLOWED ATTRIBUTE_VALUE_REPLACED
|
||||
\ ATTR_VALUE_NOT_LCASE AUDIO_MISSING_TEXT_AIFF AUDIO_MISSING_TEXT_AU
|
||||
\ AUDIO_MISSING_TEXT_RA AUDIO_MISSING_TEXT_RM AUDIO_MISSING_TEXT_SND
|
||||
\ AUDIO_MISSING_TEXT_WAV BACKSLASH_IN_URI BAD_ATTRIBUTE_VALUE
|
||||
\ BAD_ATTRIBUTE_VALUE_REPLACED BAD_CDATA_CONTENT BAD_SUMMARY_HTML5
|
||||
\ BAD_SURROGATE_LEAD BAD_SURROGATE_PAIR BAD_SURROGATE_TAIL
|
||||
\ CANT_BE_NESTED COERCE_TO_ENDTAG COLOR_CONTRAST_ACTIVE_LINK
|
||||
\ COLOR_CONTRAST_LINK COLOR_CONTRAST_TEXT COLOR_CONTRAST_VISITED_LINK
|
||||
\ CONTENT_AFTER_BODY CUSTOM_TAG_DETECTED DATA_TABLE_MISSING_HEADERS
|
||||
\ DATA_TABLE_MISSING_HEADERS_COLUMN DATA_TABLE_MISSING_HEADERS_ROW
|
||||
\ DATA_TABLE_REQUIRE_MARKUP_COLUMN_HEADERS
|
||||
\ DATA_TABLE_REQUIRE_MARKUP_ROW_HEADERS DISCARDING_UNEXPECTED
|
||||
\ DOCTYPE_AFTER_TAGS DOCTYPE_MISSING DUPLICATE_FRAMESET
|
||||
\ ELEMENT_NOT_EMPTY ELEMENT_VERS_MISMATCH_ERROR
|
||||
\ ELEMENT_VERS_MISMATCH_WARN ENCODING_MISMATCH
|
||||
\ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_APPLET
|
||||
\ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_EMBED
|
||||
\ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_OBJECT
|
||||
\ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_SCRIPT ESCAPED_ILLEGAL_URI
|
||||
\ FILE_CANT_OPEN FILE_CANT_OPEN_CFG FILE_NOT_FILE FIXED_BACKSLASH
|
||||
\ FOUND_STYLE_IN_BODY FRAME_MISSING_LONGDESC FRAME_MISSING_NOFRAMES
|
||||
\ FRAME_MISSING_TITLE FRAME_SRC_INVALID FRAME_TITLE_INVALID_NULL
|
||||
\ FRAME_TITLE_INVALID_SPACES HEADERS_IMPROPERLY_NESTED
|
||||
\ HEADER_USED_FORMAT_TEXT ID_NAME_MISMATCH ILLEGAL_NESTING
|
||||
\ ILLEGAL_URI_CODEPOINT ILLEGAL_URI_REFERENCE
|
||||
\ IMAGE_MAP_SERVER_SIDE_REQUIRES_CONVERSION
|
||||
\ IMG_ALT_SUSPICIOUS_FILENAME IMG_ALT_SUSPICIOUS_FILE_SIZE
|
||||
\ IMG_ALT_SUSPICIOUS_PLACEHOLDER IMG_ALT_SUSPICIOUS_TOO_LONG
|
||||
\ IMG_BUTTON_MISSING_ALT IMG_MAP_CLIENT_MISSING_TEXT_LINKS
|
||||
\ IMG_MAP_SERVER_REQUIRES_TEXT_LINKS IMG_MISSING_ALT IMG_MISSING_DLINK
|
||||
\ IMG_MISSING_LONGDESC IMG_MISSING_LONGDESC_DLINK
|
||||
\ INFORMATION_NOT_CONVEYED_APPLET INFORMATION_NOT_CONVEYED_IMAGE
|
||||
\ INFORMATION_NOT_CONVEYED_INPUT INFORMATION_NOT_CONVEYED_OBJECT
|
||||
\ INFORMATION_NOT_CONVEYED_SCRIPT INSERTING_AUTO_ATTRIBUTE
|
||||
\ INSERTING_TAG INVALID_ATTRIBUTE INVALID_NCR INVALID_SGML_CHARS
|
||||
\ INVALID_UTF16 INVALID_UTF8 INVALID_XML_ID JOINING_ATTRIBUTE
|
||||
\ LANGUAGE_INVALID LANGUAGE_NOT_IDENTIFIED
|
||||
\ LAYOUT_TABLES_LINEARIZE_PROPERLY LAYOUT_TABLE_INVALID_MARKUP
|
||||
\ LINK_TEXT_MISSING LINK_TEXT_NOT_MEANINGFUL
|
||||
\ LINK_TEXT_NOT_MEANINGFUL_CLICK_HERE LINK_TEXT_TOO_LONG
|
||||
\ LIST_USAGE_INVALID_LI LIST_USAGE_INVALID_OL LIST_USAGE_INVALID_UL
|
||||
\ MALFORMED_COMMENT MALFORMED_COMMENT_DROPPING MALFORMED_COMMENT_EOS
|
||||
\ MALFORMED_COMMENT_WARN MALFORMED_DOCTYPE METADATA_MISSING
|
||||
\ METADATA_MISSING_REDIRECT_AUTOREFRESH MISMATCHED_ATTRIBUTE_ERROR
|
||||
\ MISMATCHED_ATTRIBUTE_WARN MISSING_ATTRIBUTE MISSING_ATTR_VALUE
|
||||
\ MISSING_DOCTYPE MISSING_ENDTAG_BEFORE MISSING_ENDTAG_FOR
|
||||
\ MISSING_ENDTAG_OPTIONAL MISSING_IMAGEMAP MISSING_QUOTEMARK
|
||||
\ MISSING_QUOTEMARK_OPEN MISSING_SEMICOLON MISSING_SEMICOLON_NCR
|
||||
\ MISSING_STARTTAG MISSING_TITLE_ELEMENT MOVED_STYLE_TO_HEAD
|
||||
\ MULTIMEDIA_REQUIRES_TEXT NESTED_EMPHASIS NESTED_QUOTATION
|
||||
\ NEWLINE_IN_URI NEW_WINDOWS_REQUIRE_WARNING_BLANK
|
||||
\ NEW_WINDOWS_REQUIRE_WARNING_NEW NOFRAMES_CONTENT
|
||||
\ NOFRAMES_INVALID_CONTENT NOFRAMES_INVALID_LINK
|
||||
\ NOFRAMES_INVALID_NO_VALUE NON_MATCHING_ENDTAG OBJECT_MISSING_ALT
|
||||
\ OBSOLETE_ELEMENT OPTION_REMOVED OPTION_REMOVED_APPLIED
|
||||
\ OPTION_REMOVED_UNAPPLIED POTENTIAL_HEADER_BOLD
|
||||
\ POTENTIAL_HEADER_ITALICS POTENTIAL_HEADER_UNDERLINE
|
||||
\ PREVIOUS_LOCATION PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_APPLET
|
||||
\ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_EMBED
|
||||
\ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_OBJECT
|
||||
\ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_SCRIPT PROPRIETARY_ATTRIBUTE
|
||||
\ PROPRIETARY_ATTR_VALUE PROPRIETARY_ELEMENT REMOVED_HTML5
|
||||
\ REMOVE_AUTO_REDIRECT REMOVE_AUTO_REFRESH REMOVE_BLINK_MARQUEE
|
||||
\ REMOVE_FLICKER_ANIMATED_GIF REMOVE_FLICKER_APPLET
|
||||
\ REMOVE_FLICKER_EMBED REMOVE_FLICKER_OBJECT REMOVE_FLICKER_SCRIPT
|
||||
\ REPEATED_ATTRIBUTE REPLACE_DEPRECATED_HTML_APPLET
|
||||
\ REPLACE_DEPRECATED_HTML_BASEFONT REPLACE_DEPRECATED_HTML_CENTER
|
||||
\ REPLACE_DEPRECATED_HTML_DIR REPLACE_DEPRECATED_HTML_FONT
|
||||
\ REPLACE_DEPRECATED_HTML_ISINDEX REPLACE_DEPRECATED_HTML_MENU
|
||||
\ REPLACE_DEPRECATED_HTML_S REPLACE_DEPRECATED_HTML_STRIKE
|
||||
\ REPLACE_DEPRECATED_HTML_U REPLACING_ELEMENT REPLACING_UNEX_ELEMENT
|
||||
\ SCRIPT_MISSING_NOSCRIPT SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_CLICK
|
||||
\ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_DOWN
|
||||
\ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_MOVE
|
||||
\ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OUT
|
||||
\ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OVER
|
||||
\ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_UP SKIPOVER_ASCII_ART
|
||||
\ SPACE_PRECEDING_XMLDECL STRING_ARGUMENT_BAD STRING_CONTENT_LOOKS
|
||||
\ STRING_DOCTYPE_GIVEN STRING_MISSING_MALFORMED STRING_MUTING_TYPE
|
||||
\ STRING_NO_SYSID STRING_UNKNOWN_OPTION
|
||||
\ STYLESHEETS_REQUIRE_TESTING_LINK
|
||||
\ STYLESHEETS_REQUIRE_TESTING_STYLE_ATTR
|
||||
\ STYLESHEETS_REQUIRE_TESTING_STYLE_ELEMENT
|
||||
\ STYLE_SHEET_CONTROL_PRESENTATION SUSPECTED_MISSING_QUOTE
|
||||
\ TABLE_MAY_REQUIRE_HEADER_ABBR TABLE_MAY_REQUIRE_HEADER_ABBR_NULL
|
||||
\ TABLE_MAY_REQUIRE_HEADER_ABBR_SPACES TABLE_MISSING_CAPTION
|
||||
\ TABLE_MISSING_SUMMARY TABLE_SUMMARY_INVALID_NULL
|
||||
\ TABLE_SUMMARY_INVALID_PLACEHOLDER TABLE_SUMMARY_INVALID_SPACES
|
||||
\ TAG_NOT_ALLOWED_IN TEXT_EQUIVALENTS_REQUIRE_UPDATING_APPLET
|
||||
\ TEXT_EQUIVALENTS_REQUIRE_UPDATING_OBJECT
|
||||
\ TEXT_EQUIVALENTS_REQUIRE_UPDATING_SCRIPT TOO_MANY_ELEMENTS
|
||||
\ TOO_MANY_ELEMENTS_IN TRIM_EMPTY_ELEMENT UNESCAPED_AMPERSAND
|
||||
\ UNEXPECTED_ENDTAG UNEXPECTED_ENDTAG_ERR UNEXPECTED_ENDTAG_IN
|
||||
\ UNEXPECTED_END_OF_FILE UNEXPECTED_END_OF_FILE_ATTR
|
||||
\ UNEXPECTED_EQUALSIGN UNEXPECTED_GT UNEXPECTED_QUOTEMARK
|
||||
\ UNKNOWN_ELEMENT UNKNOWN_ELEMENT_LOOKS_CUSTOM UNKNOWN_ENTITY
|
||||
\ USING_BR_INPLACE_OF VENDOR_SPECIFIC_CHARS WHITE_IN_URI
|
||||
\ XML_DECLARATION_DETECTED XML_ID_SYNTAX
|
||||
\ contained nextgroup=tidyMuteIDSeparator skipwhite skipnl
|
||||
|
||||
" Options {{{1
|
||||
syn keyword tidyCustomTagsOption custom-tags contained nextgroup=tidyCustomTagsDelimiter
|
||||
syn match tidyCustomTagsDelimiter ":" nextgroup=tidyCustomTags contained skipwhite
|
||||
|
||||
syn keyword tidyBooleanOption add-meta-charset add-xml-decl
|
||||
\ add-xml-pi add-xml-space anchor-as-name ascii-chars
|
||||
\ assume-xml-procins bare break-before-br clean coerce-endtags
|
||||
\ decorate-inferred-ul drop-empty-paras drop-empty-elements
|
||||
\ drop-font-tags drop-proprietary-attributes enclose-block-text
|
||||
\ enclose-text escape-cdata escape-scripts fix-backslash
|
||||
\ fix-style-tags fix-uri force-output gdoc gnu-emacs hide-comments
|
||||
\ hide-endtags indent-attributes indent-cdata indent-with-tabs
|
||||
\ input-xml join-classes join-styles keep-tabs keep-time language
|
||||
\ literal-attributes logical-emphasis lower-literals markup
|
||||
\ merge-emphasis mute-id ncr numeric-entities omit-optional-tags
|
||||
\ output-html output-xhtml output-xml preserve-entities
|
||||
\ punctuation-wrap quiet quote-ampersand quote-marks quote-nbsp raw
|
||||
\ replace-color show-filename show-info show-meta-change show-warnings
|
||||
\ skip-nested split strict-tags-attributes tidy-mark
|
||||
\ uppercase-attributes uppercase-tags warn-proprietary-attributes
|
||||
\ word-2000 wrap-asp wrap-attributes wrap-jste wrap-php
|
||||
\ wrap-script-literals wrap-sections write-back
|
||||
\ contained nextgroup=tidyBooleanDelimiter
|
||||
|
||||
syn match tidyBooleanDelimiter ":" nextgroup=tidyBoolean contained skipwhite
|
||||
|
||||
syn keyword tidyAutoBooleanOption indent merge-divs merge-spans output-bom show-body-only vertical-space contained nextgroup=tidyAutoBooleanDelimiter
|
||||
syn keyword tidyAutoBooleanOption fix-bad-comments indent merge-divs merge-spans output-bom show-body-only vertical-space contained nextgroup=tidyAutoBooleanDelimiter
|
||||
syn match tidyAutoBooleanDelimiter ":" nextgroup=tidyAutoBoolean contained skipwhite
|
||||
|
||||
syn keyword tidyCSSSelectorOption css-prefix contained nextgroup=tidyCSSSelectorDelimiter
|
||||
syn match tidyCSSSelectorDelimiter ":" nextgroup=tidyCSSSelector contained skipwhite
|
||||
|
||||
syn keyword tidyDoctypeOption doctype contained nextgroup=tidyDoctypeDelimiter
|
||||
syn match tidyDoctypeDelimiter ":" nextgroup=tidyDoctype contained skipwhite
|
||||
syn match tidyDoctypeDelimiter ":" nextgroup=tidyDoctype,tidyString contained skipwhite
|
||||
|
||||
syn keyword tidyEncodingOption char-encoding input-encoding output-encoding contained nextgroup=tidyEncodingDelimiter
|
||||
syn match tidyEncodingDelimiter ":" nextgroup=tidyEncoding contained skipwhite
|
||||
@@ -67,8 +185,11 @@ syn match tidyNameDelimiter ":" nextgroup=tidyName contained skipwhite
|
||||
syn keyword tidyNewlineOption newline contained nextgroup=tidyNewlineDelimiter
|
||||
syn match tidyNewlineDelimiter ":" nextgroup=tidyNewline contained skipwhite
|
||||
|
||||
syn keyword tidyAttributesOption priority-attributes contained nextgroup=tidyAttributesDelimiter
|
||||
syn match tidyAttributesDelimiter ":" nextgroup=tidyWord contained skipwhite
|
||||
|
||||
syn keyword tidyTagsOption new-blocklevel-tags new-empty-tags new-inline-tags new-pre-tags contained nextgroup=tidyTagsDelimiter
|
||||
syn match tidyTagsDelimiter ":" nextgroup=tidyTags contained skipwhite
|
||||
syn match tidyTagsDelimiter ":" nextgroup=tidyWord contained skipwhite
|
||||
|
||||
syn keyword tidyRepeatOption repeated-attributes contained nextgroup=tidyRepeatDelimiter
|
||||
syn match tidyRepeatDelimiter ":" nextgroup=tidyRepeat contained skipwhite
|
||||
@@ -79,57 +200,77 @@ syn match tidySorterDelimiter ":" nextgroup=tidySorter contained skipwhite
|
||||
syn keyword tidyStringOption alt-text error-file gnu-emacs-file output-file contained nextgroup=tidyStringDelimiter
|
||||
syn match tidyStringDelimiter ":" nextgroup=tidyString contained skipwhite
|
||||
|
||||
syn keyword tidyMuteOption mute contained nextgroup=tidyMuteDelimiter
|
||||
syn match tidyMuteDelimiter ":" nextgroup=tidyMuteID contained skipwhite
|
||||
|
||||
syn cluster tidyOptions contains=tidy.*Option
|
||||
|
||||
" Option line anchor {{{1
|
||||
syn match tidyStart "^" nextgroup=@tidyOptions
|
||||
" Long standing bug - option lines (except the first) with leading whitespace
|
||||
" are silently ignored.
|
||||
syn match tidyErrorStart '^\s\+\ze\S'
|
||||
|
||||
" Comments {{{1
|
||||
syn match tidyComment "^\s*//.*$" contains=tidyTodo
|
||||
syn match tidyComment "^\s*#.*$" contains=tidyTodo
|
||||
syn keyword tidyTodo TODO NOTE FIXME XXX contained
|
||||
|
||||
" Default highlighting {{{1
|
||||
hi def link tidyAttributesOption Identifier
|
||||
hi def link tidyAutoBooleanOption Identifier
|
||||
hi def link tidyBooleanOption Identifier
|
||||
hi def link tidyCSSSelectorOption Identifier
|
||||
hi def link tidyCustomTagsOption Identifier
|
||||
hi def link tidyDoctypeOption Identifier
|
||||
hi def link tidyEncodingOption Identifier
|
||||
hi def link tidyIntegerOption Identifier
|
||||
hi def link tidyMuteOption Identifier
|
||||
hi def link tidyNameOption Identifier
|
||||
hi def link tidyNewlineOption Identifier
|
||||
hi def link tidyTagsOption Identifier
|
||||
hi def link tidyRepeatOption Identifier
|
||||
hi def link tidySorterOption Identifier
|
||||
hi def link tidyStringOption Identifier
|
||||
hi def link tidyTagsOption Identifier
|
||||
|
||||
hi def link tidyAttributesDelimiter Special
|
||||
hi def link tidyAutoBooleanDelimiter Special
|
||||
hi def link tidyBooleanDelimiter Special
|
||||
hi def link tidyCSSSelectorDelimiter Special
|
||||
hi def link tidyCustomTagsDelimiter Special
|
||||
hi def link tidyDoctypeDelimiter Special
|
||||
hi def link tidyEncodingDelimiter Special
|
||||
hi def link tidyIntegerDelimiter Special
|
||||
hi def link tidyMuteDelimiter Special
|
||||
hi def link tidyNameDelimiter Special
|
||||
hi def link tidyNewlineDelimiter Special
|
||||
hi def link tidyTagsDelimiter Special
|
||||
hi def link tidyRepeatDelimiter Special
|
||||
hi def link tidySorterDelimiter Special
|
||||
hi def link tidyStringDelimiter Special
|
||||
hi def link tidyTagsDelimiter Special
|
||||
|
||||
hi def link tidyAutoBoolean Boolean
|
||||
hi def link tidyBoolean Boolean
|
||||
hi def link tidyCustomTags Constant
|
||||
hi def link tidyDoctype Constant
|
||||
hi def link tidyEncoding Constant
|
||||
hi def link tidyMuteID Constant
|
||||
hi def link tidyNewline Constant
|
||||
hi def link tidyTags Constant
|
||||
hi def link tidyNumber Number
|
||||
hi def link tidyRepeat Constant
|
||||
hi def link tidySorter Constant
|
||||
hi def link tidyString String
|
||||
hi def link tidyWord Constant
|
||||
|
||||
hi def link tidyComment Comment
|
||||
hi def link tidyTodo Todo
|
||||
|
||||
hi def link tidyErrorStart Error
|
||||
|
||||
" Postscript {{{1
|
||||
let b:current_syntax = "tidy"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: ts=8
|
||||
" vim: ts=8 fdm=marker
|
||||
|
||||
@@ -907,7 +907,7 @@ ce 는 단어를 치환하는 것 뿐만 아니라, 내용을 삽입할 수 있
|
||||
|
||||
5. <TAB> 을 눌러 ":edit" 명령어를 완성해 봅니다.
|
||||
|
||||
6. 이제 빈칸 하나를 추가한 뒤, 존재 파일 이름을 앞 부분을 입력합니다: :edit FIL
|
||||
6. 이제 빈칸 하나를 추가한 뒤, 존재하는 파일 이름의 앞 부분을 입력합니다: :edit FIL
|
||||
|
||||
7. <TAB> 을 눌러 파일 이름을 완성 시킵니다.
|
||||
|
||||
|
||||
@@ -907,7 +907,7 @@ ce
|
||||
|
||||
5. <TAB> <20><> <20><><EFBFBD><EFBFBD> ":edit" <20><><EFBFBD>ɾ <20>ϼ<EFBFBD><CFBC><EFBFBD> <20><><EFBFBD>ϴ<EFBFBD>.
|
||||
|
||||
6. <20><><EFBFBD><EFBFBD> <20><>ĭ <20>ϳ<EFBFBD><CFB3><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><> <20>κ<EFBFBD><CEBA><EFBFBD> <20>Է<EFBFBD><D4B7>մϴ<D5B4>: :edit FIL
|
||||
6. <20><><EFBFBD><EFBFBD> <20><>ĭ <20>ϳ<EFBFBD><CFB3><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><>, <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><> <20>κ<EFBFBD><CEBA><EFBFBD> <20>Է<EFBFBD><D4B7>մϴ<D5B4>: :edit FIL
|
||||
|
||||
7. <TAB> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20>ϼ<EFBFBD> <20><>ŵ<EFBFBD>ϴ<EFBFBD>.
|
||||
|
||||
|
||||
@@ -907,7 +907,7 @@ ce 는 단어를 치환하는 것 뿐만 아니라, 내용을 삽입할 수 있
|
||||
|
||||
5. <TAB> 을 눌러 ":edit" 명령어를 완성해 봅니다.
|
||||
|
||||
6. 이제 빈칸 하나를 추가한 뒤, 존재 파일 이름을 앞 부분을 입력합니다: :edit FIL
|
||||
6. 이제 빈칸 하나를 추가한 뒤, 존재하는 파일 이름의 앞 부분을 입력합니다: :edit FIL
|
||||
|
||||
7. <TAB> 을 눌러 파일 이름을 완성 시킵니다.
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ WINVER = 0x0501
|
||||
endif
|
||||
CXX := $(CROSS_COMPILE)g++
|
||||
WINDRES := $(CROSS_COMPILE)windres
|
||||
WINDRES_CXX = $(CXX)
|
||||
WINDRES_FLAGS = --preprocessor="$(WINDRES_CXX) -E -xc" -DRC_INVOKED
|
||||
# this used to have --preprocessor, but it's no longer supported
|
||||
WINDRES_FLAGS =
|
||||
LIBS := -luuid -lgdi32
|
||||
RES := gvimext.res
|
||||
DEFFILE = gvimext_ming.def
|
||||
|
||||
@@ -220,7 +220,6 @@ WINDRES := $(CROSS_COMPILE)windres
|
||||
else
|
||||
WINDRES := windres
|
||||
endif
|
||||
WINDRES_CC = $(CC)
|
||||
|
||||
# Get the default ARCH.
|
||||
ifndef ARCH
|
||||
@@ -514,7 +513,8 @@ endif
|
||||
|
||||
CFLAGS = -I. -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
|
||||
CXXFLAGS = -std=gnu++11
|
||||
WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
|
||||
# This used to have --preprocessor, but it's no longer supported
|
||||
WINDRES_FLAGS =
|
||||
EXTRA_LIBS =
|
||||
|
||||
ifdef GETTEXT
|
||||
|
||||
@@ -17,12 +17,29 @@
|
||||
#define AL_ADD 2
|
||||
#define AL_DEL 3
|
||||
|
||||
// This flag is set whenever the argument list is being changed and calling a
|
||||
// function that might trigger an autocommand.
|
||||
static int arglist_locked = FALSE;
|
||||
|
||||
static int
|
||||
check_arglist_locked(void)
|
||||
{
|
||||
if (arglist_locked)
|
||||
{
|
||||
emsg(_(e_cannot_change_arglist_recursively));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear an argument list: free all file names and reset it to zero entries.
|
||||
*/
|
||||
void
|
||||
alist_clear(alist_T *al)
|
||||
{
|
||||
if (check_arglist_locked() == FAIL)
|
||||
return;
|
||||
while (--al->al_ga.ga_len >= 0)
|
||||
vim_free(AARGLIST(al)[al->al_ga.ga_len].ae_fname);
|
||||
ga_clear(&al->al_ga);
|
||||
@@ -126,14 +143,9 @@ alist_set(
|
||||
int fnum_len)
|
||||
{
|
||||
int i;
|
||||
static int recursive = 0;
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
emsg(_(e_au_recursive));
|
||||
if (check_arglist_locked() == FAIL)
|
||||
return;
|
||||
}
|
||||
++recursive;
|
||||
|
||||
alist_clear(al);
|
||||
if (ga_grow(&al->al_ga, count) == OK)
|
||||
@@ -152,7 +164,11 @@ alist_set(
|
||||
// May set buffer name of a buffer previously used for the
|
||||
// argument list, so that it's re-used by alist_add.
|
||||
if (fnum_list != NULL && i < fnum_len)
|
||||
{
|
||||
arglist_locked = TRUE;
|
||||
buf_set_name(fnum_list[i], files[i]);
|
||||
arglist_locked = FALSE;
|
||||
}
|
||||
|
||||
alist_add(al, files[i], use_curbuf ? 2 : 1);
|
||||
ui_breakcheck();
|
||||
@@ -163,8 +179,6 @@ alist_set(
|
||||
FreeWild(count, files);
|
||||
if (al == &global_alist)
|
||||
arg_had_last = FALSE;
|
||||
|
||||
--recursive;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -179,6 +193,10 @@ alist_add(
|
||||
{
|
||||
if (fname == NULL) // don't add NULL file names
|
||||
return;
|
||||
if (check_arglist_locked() == FAIL)
|
||||
return;
|
||||
arglist_locked = TRUE;
|
||||
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
slash_adjust(fname);
|
||||
#endif
|
||||
@@ -187,6 +205,8 @@ alist_add(
|
||||
AARGLIST(al)[al->al_ga.ga_len].ae_fnum =
|
||||
buflist_add(fname, BLN_LISTED | (set_fnum == 2 ? BLN_CURBUF : 0));
|
||||
++al->al_ga.ga_len;
|
||||
|
||||
arglist_locked = FALSE;
|
||||
}
|
||||
|
||||
#if defined(BACKSLASH_IN_FILENAME) || defined(PROTO)
|
||||
@@ -334,7 +354,8 @@ alist_add_list(
|
||||
int i;
|
||||
int old_argcount = ARGCOUNT;
|
||||
|
||||
if (ga_grow(&ALIST(curwin)->al_ga, count) == OK)
|
||||
if (check_arglist_locked() != FAIL
|
||||
&& ga_grow(&ALIST(curwin)->al_ga, count) == OK)
|
||||
{
|
||||
if (after < 0)
|
||||
after = 0;
|
||||
@@ -343,6 +364,7 @@ alist_add_list(
|
||||
if (after < ARGCOUNT)
|
||||
mch_memmove(&(ARGLIST[after + count]), &(ARGLIST[after]),
|
||||
(ARGCOUNT - after) * sizeof(aentry_T));
|
||||
arglist_locked = TRUE;
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
int flags = BLN_LISTED | (will_edit ? BLN_CURBUF : 0);
|
||||
@@ -350,6 +372,7 @@ alist_add_list(
|
||||
ARGLIST[after + i].ae_fname = files[i];
|
||||
ARGLIST[after + i].ae_fnum = buflist_add(files[i], flags);
|
||||
}
|
||||
arglist_locked = FALSE;
|
||||
ALIST(curwin)->al_ga.ga_len += count;
|
||||
if (old_argcount > 0 && curwin->w_arg_idx >= after)
|
||||
curwin->w_arg_idx += count;
|
||||
@@ -382,6 +405,9 @@ do_arglist(
|
||||
int match;
|
||||
int arg_escaped = TRUE;
|
||||
|
||||
if (check_arglist_locked() == FAIL)
|
||||
return FAIL;
|
||||
|
||||
// Set default argument for ":argadd" command.
|
||||
if (what == AL_ADD && *str == NUL)
|
||||
{
|
||||
@@ -776,6 +802,9 @@ ex_argdelete(exarg_T *eap)
|
||||
int i;
|
||||
int n;
|
||||
|
||||
if (check_arglist_locked() == FAIL)
|
||||
return;
|
||||
|
||||
if (eap->addr_count > 0 || *eap->arg == NUL)
|
||||
{
|
||||
// ":argdel" works like ":.argdel"
|
||||
@@ -884,6 +913,13 @@ do_arg_all(
|
||||
win_T *new_curwin = NULL;
|
||||
tabpage_T *new_curtab = NULL;
|
||||
|
||||
#ifdef FEAT_CMDWIN
|
||||
if (cmdwin_type != 0)
|
||||
{
|
||||
emsg(_(e_cmdwin));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (ARGCOUNT <= 0)
|
||||
{
|
||||
// Don't give an error message. We don't want it when the ":all"
|
||||
|
||||
@@ -956,11 +956,14 @@ do_autocmd(char_u *arg_in, int forceit)
|
||||
last_group = AUGROUP_ERROR; // for listing the group name
|
||||
if (*arg == '*' || *arg == NUL || *arg == '|')
|
||||
{
|
||||
for (event = (event_T)0; (int)event < (int)NUM_EVENTS;
|
||||
event = (event_T)((int)event + 1))
|
||||
if (do_autocmd_event(event, pat,
|
||||
once, nested, cmd, forceit, group) == FAIL)
|
||||
break;
|
||||
if (!forceit && *cmd != NUL)
|
||||
emsg(_(e_cannot_define_autocommands_for_all_events));
|
||||
else
|
||||
for (event = (event_T)0; (int)event < (int)NUM_EVENTS;
|
||||
event = (event_T)((int)event + 1))
|
||||
if (do_autocmd_event(event, pat,
|
||||
once, nested, cmd, forceit, group) == FAIL)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -864,7 +864,7 @@ has_profiling(
|
||||
*/
|
||||
static linenr_T
|
||||
debuggy_find(
|
||||
int file, // TRUE for a file, FALSE for a function
|
||||
int is_file, // TRUE for a file, FALSE for a function
|
||||
char_u *fname, // file or function name
|
||||
linenr_T after, // after this line number
|
||||
garray_T *gap, // either &dbg_breakp or &prof_ga
|
||||
@@ -873,20 +873,25 @@ debuggy_find(
|
||||
struct debuggy *bp;
|
||||
int i;
|
||||
linenr_T lnum = 0;
|
||||
char_u *name = fname;
|
||||
char_u *name = NULL;
|
||||
char_u *short_name = fname;
|
||||
int prev_got_int;
|
||||
|
||||
// Return quickly when there are no breakpoints.
|
||||
if (gap->ga_len == 0)
|
||||
return (linenr_T)0;
|
||||
|
||||
// Replace K_SNR in function name with "<SNR>".
|
||||
if (!file && fname[0] == K_SPECIAL)
|
||||
// For a script-local function remove the prefix, so that
|
||||
// "profile func Func" matches "Func" in any script. Otherwise it's very
|
||||
// difficult to profile/debug a script-local function. It may match a
|
||||
// function in the wrong script, but that is much better than not being
|
||||
// able to profile/debug a function in a script with unknown ID.
|
||||
// Also match a script-specific name.
|
||||
if (!is_file && fname[0] == K_SPECIAL)
|
||||
{
|
||||
short_name = vim_strchr(fname, '_') + 1;
|
||||
name = alloc(STRLEN(fname) + 3);
|
||||
if (name == NULL)
|
||||
name = fname;
|
||||
else
|
||||
if (name != NULL)
|
||||
{
|
||||
STRCPY(name, "<SNR>");
|
||||
STRCPY(name + 5, fname + 3);
|
||||
@@ -898,8 +903,8 @@ debuggy_find(
|
||||
// Skip entries that are not useful or are for a line that is beyond
|
||||
// an already found breakpoint.
|
||||
bp = &DEBUGGY(gap, i);
|
||||
if (((bp->dbg_type == DBG_FILE) == file &&
|
||||
bp->dbg_type != DBG_EXPR && (
|
||||
if (((bp->dbg_type == DBG_FILE) == is_file
|
||||
&& bp->dbg_type != DBG_EXPR && (
|
||||
#ifdef FEAT_PROFILE
|
||||
gap == &prof_ga ||
|
||||
#endif
|
||||
@@ -910,7 +915,10 @@ debuggy_find(
|
||||
// while matching should abort it.
|
||||
prev_got_int = got_int;
|
||||
got_int = FALSE;
|
||||
if (vim_regexec_prog(&bp->dbg_prog, FALSE, name, (colnr_T)0))
|
||||
if ((name != NULL
|
||||
&& vim_regexec_prog(&bp->dbg_prog, FALSE, name, (colnr_T)0))
|
||||
|| vim_regexec_prog(&bp->dbg_prog, FALSE,
|
||||
short_name, (colnr_T)0))
|
||||
{
|
||||
lnum = bp->dbg_lnum;
|
||||
if (fp != NULL)
|
||||
|
||||
@@ -196,6 +196,10 @@ edit(
|
||||
#endif
|
||||
ins_apply_autocmds(EVENT_INSERTENTER);
|
||||
|
||||
// Check for changed highlighting, e.g. for ModeMsg.
|
||||
if (need_highlight_changed)
|
||||
highlight_changed();
|
||||
|
||||
// Make sure the cursor didn't move. Do call check_cursor_col() in
|
||||
// case the text was modified. Since Insert mode was not started yet
|
||||
// a call to check_cursor_col() may move the cursor, especially with
|
||||
|
||||
@@ -345,3 +345,7 @@ EXTERN char e_invalid_operation_for_bool[]
|
||||
INIT(= N_("E1153: Invalid operation for bool"));
|
||||
EXTERN char e_divide_by_zero[]
|
||||
INIT(= N_("E1154: Divide by zero"));
|
||||
EXTERN char e_cannot_define_autocommands_for_all_events[]
|
||||
INIT(= N_("E1155: Cannot define autocommands for ALL events"));
|
||||
EXTERN char e_cannot_change_arglist_recursively[]
|
||||
INIT(= N_("E1156: Cannot change the argument list recursively"));
|
||||
|
||||
@@ -4651,6 +4651,13 @@ f_has(typval_T *argvars, typval_T *rettv)
|
||||
},
|
||||
{"cmdline_compl", 1},
|
||||
{"cmdline_hist", 1},
|
||||
{"cmdwin",
|
||||
#ifdef FEAT_CMDWIN
|
||||
1
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
},
|
||||
{"comments", 1},
|
||||
{"conceal",
|
||||
#ifdef FEAT_CONCEAL
|
||||
|
||||
@@ -3747,6 +3747,8 @@ ex_substitute(exarg_T *eap)
|
||||
{
|
||||
linenr_T joined_lines_count;
|
||||
|
||||
if (eap->skip)
|
||||
return;
|
||||
curwin->w_cursor.lnum = eap->line1;
|
||||
if (*cmd == 'l')
|
||||
eap->flags = EXFLAG_LIST;
|
||||
|
||||
@@ -489,7 +489,7 @@ EXCMD(CMD_digraphs, "digraphs", ex_digraphs,
|
||||
EX_BANG|EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_disassemble, "disassemble", ex_disassemble,
|
||||
EX_EXTRA|EX_NEEDARG|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
EX_BANG|EX_EXTRA|EX_NEEDARG|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK,
|
||||
ADDR_NONE),
|
||||
EXCMD(CMD_djump, "djump", ex_findpat,
|
||||
EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA,
|
||||
|
||||
@@ -696,11 +696,8 @@ do_cmdline(
|
||||
++call_depth;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
CLEAR_FIELD(cstack);
|
||||
cstack.cs_idx = -1;
|
||||
cstack.cs_looplevel = 0;
|
||||
cstack.cs_trylevel = 0;
|
||||
cstack.cs_emsg_silent_list = NULL;
|
||||
cstack.cs_lflags = 0;
|
||||
ga_init2(&lines_ga, (int)sizeof(wcmd_T), 10);
|
||||
|
||||
real_cookie = getline_cookie(fgetline, cookie);
|
||||
@@ -866,7 +863,7 @@ do_cmdline(
|
||||
if (do_profiling == PROF_YES)
|
||||
{
|
||||
if (getline_is_func)
|
||||
func_line_start(real_cookie);
|
||||
func_line_start(real_cookie, SOURCING_LNUM);
|
||||
else if (getline_equal(fgetline, cookie, getsourceline))
|
||||
script_line_start();
|
||||
}
|
||||
|
||||
@@ -920,6 +920,13 @@ enter_block(cstack_T *cstack)
|
||||
cstack->cs_block_id[cstack->cs_idx] = ++si->sn_last_block_id;
|
||||
si->sn_current_block_id = si->sn_last_block_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just in case in_vim9script() does not return the same value when the
|
||||
// block ends.
|
||||
cstack->cs_script_var_len[cstack->cs_idx] = 0;
|
||||
cstack->cs_block_id[cstack->cs_idx] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -4205,15 +4205,18 @@ open_cmdwin(void)
|
||||
// Don't let quitting the More prompt make this fail.
|
||||
got_int = FALSE;
|
||||
|
||||
// Set "cmdwin_type" before any autocommands may mess things up.
|
||||
cmdwin_type = get_cmdline_type();
|
||||
|
||||
// Create the command-line buffer empty.
|
||||
if (do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL) == FAIL)
|
||||
{
|
||||
// Some autocommand messed it up?
|
||||
win_close(curwin, TRUE);
|
||||
ga_clear(&winsizes);
|
||||
cmdwin_type = 0;
|
||||
return Ctrl_C;
|
||||
}
|
||||
cmdwin_type = get_cmdline_type();
|
||||
|
||||
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
|
||||
(void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
|
||||
@@ -4393,10 +4396,15 @@ open_cmdwin(void)
|
||||
// Avoid command-line window first character being concealed.
|
||||
curwin->w_p_cole = 0;
|
||||
# endif
|
||||
// First go back to the original window.
|
||||
wp = curwin;
|
||||
set_bufref(&bufref, curbuf);
|
||||
win_goto(old_curwin);
|
||||
win_close(wp, TRUE);
|
||||
|
||||
// win_goto() may trigger an autocommand that already closes the
|
||||
// cmdline window.
|
||||
if (win_valid(wp))
|
||||
win_close(wp, TRUE);
|
||||
|
||||
// win_close() may have already wiped the buffer when 'bh' is
|
||||
// set to 'wipe'
|
||||
|
||||
21
src/mark.c
21
src/mark.c
@@ -140,9 +140,6 @@ setpcmark(void)
|
||||
int i;
|
||||
xfmark_T *fm;
|
||||
#endif
|
||||
#ifdef JUMPLIST_ROTATE
|
||||
xfmark_T tempmark;
|
||||
#endif
|
||||
|
||||
// for :global the mark is set only once
|
||||
if (global_busy || listcmd_busy || (cmdmod.cmod_flags & CMOD_KEEPJUMPS))
|
||||
@@ -152,24 +149,6 @@ setpcmark(void)
|
||||
curwin->w_pcmark = curwin->w_cursor;
|
||||
|
||||
#ifdef FEAT_JUMPLIST
|
||||
# ifdef JUMPLIST_ROTATE
|
||||
/*
|
||||
* If last used entry is not at the top, put it at the top by rotating
|
||||
* the stack until it is (the newer entries will be at the bottom).
|
||||
* Keep one entry (the last used one) at the top.
|
||||
*/
|
||||
if (curwin->w_jumplistidx < curwin->w_jumplistlen)
|
||||
++curwin->w_jumplistidx;
|
||||
while (curwin->w_jumplistidx < curwin->w_jumplistlen)
|
||||
{
|
||||
tempmark = curwin->w_jumplist[curwin->w_jumplistlen - 1];
|
||||
for (i = curwin->w_jumplistlen - 1; i > 0; --i)
|
||||
curwin->w_jumplist[i] = curwin->w_jumplist[i - 1];
|
||||
curwin->w_jumplist[0] = tempmark;
|
||||
++curwin->w_jumplistidx;
|
||||
}
|
||||
# endif
|
||||
|
||||
// If jumplist is full: remove oldest entry
|
||||
if (++curwin->w_jumplistlen > JUMPLISTSIZE)
|
||||
{
|
||||
|
||||
@@ -630,7 +630,7 @@ getcount:
|
||||
}
|
||||
else
|
||||
ca.count0 = ca.count0 * 10 + (c - '0');
|
||||
if (ca.count0 < 0) // got too large!
|
||||
if (ca.count0 < 0) // overflow
|
||||
ca.count0 = 999999999L;
|
||||
#ifdef FEAT_EVAL
|
||||
// Set v:count here, when called from main() and not a stuffed
|
||||
@@ -701,6 +701,8 @@ getcount:
|
||||
ca.count0 *= ca.opcount;
|
||||
else
|
||||
ca.count0 = ca.opcount;
|
||||
if (ca.count0 < 0) // overflow
|
||||
ca.count0 = 999999999L;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4775,6 +4777,8 @@ nv_percent(cmdarg_T *cap)
|
||||
else
|
||||
curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count *
|
||||
cap->count0 + 99L) / 100L;
|
||||
if (curwin->w_cursor.lnum < 1)
|
||||
curwin->w_cursor.lnum = 1;
|
||||
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
|
||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||
beginline(BL_SOL | BL_FIX);
|
||||
|
||||
@@ -554,6 +554,51 @@ func_do_profile(ufunc_T *fp)
|
||||
fp->uf_profiling = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* When calling a function: may initialize for profiling.
|
||||
*/
|
||||
void
|
||||
profile_may_start_func(profinfo_T *info, ufunc_T *fp, funccall_T *fc)
|
||||
{
|
||||
if (do_profiling == PROF_YES)
|
||||
{
|
||||
if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
|
||||
{
|
||||
info->pi_started_profiling = TRUE;
|
||||
func_do_profile(fp);
|
||||
}
|
||||
if (fp->uf_profiling
|
||||
|| (fc->caller != NULL && fc->caller->func->uf_profiling))
|
||||
{
|
||||
++fp->uf_tm_count;
|
||||
profile_start(&info->pi_call_start);
|
||||
profile_zero(&fp->uf_tm_children);
|
||||
}
|
||||
script_prof_save(&info->pi_wait_start);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* After calling a function: may handle profiling. profile_may_start_func()
|
||||
* must have been called previously.
|
||||
*/
|
||||
void
|
||||
profile_may_end_func(profinfo_T *info, ufunc_T *fp, funccall_T *fc)
|
||||
{
|
||||
profile_end(&info->pi_call_start);
|
||||
profile_sub_wait(&info->pi_wait_start, &info->pi_call_start);
|
||||
profile_add(&fp->uf_tm_total, &info->pi_call_start);
|
||||
profile_self(&fp->uf_tm_self, &info->pi_call_start, &fp->uf_tm_children);
|
||||
if (fc->caller != NULL && fc->caller->func->uf_profiling)
|
||||
{
|
||||
profile_add(&fc->caller->func->uf_tm_children, &info->pi_call_start);
|
||||
profile_add(&fc->caller->func->uf_tml_children, &info->pi_call_start);
|
||||
}
|
||||
if (info->pi_started_profiling)
|
||||
// make a ":profdel func" stop profiling the function
|
||||
fp->uf_profiling = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare profiling for entering a child or something else that is not
|
||||
* counted for the script/function itself.
|
||||
@@ -597,15 +642,14 @@ prof_child_exit(
|
||||
* until later and we need to store the time now.
|
||||
*/
|
||||
void
|
||||
func_line_start(void *cookie)
|
||||
func_line_start(void *cookie, long lnum)
|
||||
{
|
||||
funccall_T *fcp = (funccall_T *)cookie;
|
||||
ufunc_T *fp = fcp->func;
|
||||
|
||||
if (fp->uf_profiling && SOURCING_LNUM >= 1
|
||||
&& SOURCING_LNUM <= fp->uf_lines.ga_len)
|
||||
if (fp->uf_profiling && lnum >= 1 && lnum <= fp->uf_lines.ga_len)
|
||||
{
|
||||
fp->uf_tml_idx = SOURCING_LNUM - 1;
|
||||
fp->uf_tml_idx = lnum - 1;
|
||||
// Skip continuation lines.
|
||||
while (fp->uf_tml_idx > 0 && FUNCLINE(fp, fp->uf_tml_idx) == NULL)
|
||||
--fp->uf_tml_idx;
|
||||
|
||||
@@ -19,9 +19,11 @@ void prof_inchar_enter(void);
|
||||
void prof_inchar_exit(void);
|
||||
int prof_def_func(void);
|
||||
void func_do_profile(ufunc_T *fp);
|
||||
void profile_may_start_func(profinfo_T *info, ufunc_T *fp, funccall_T *fc);
|
||||
void profile_may_end_func(profinfo_T *info, ufunc_T *fp, funccall_T *fc);
|
||||
void prof_child_enter(proftime_T *tm);
|
||||
void prof_child_exit(proftime_T *tm);
|
||||
void func_line_start(void *cookie);
|
||||
void func_line_start(void *cookie, long lnum);
|
||||
void func_line_exec(void *cookie);
|
||||
void func_line_end(void *cookie);
|
||||
void script_do_profile(scriptitem_T *si);
|
||||
|
||||
@@ -3,6 +3,7 @@ int check_defined(char_u *p, size_t len, cctx_T *cctx);
|
||||
int check_compare_types(exprtype_T type, typval_T *tv1, typval_T *tv2);
|
||||
int use_typecheck(type_T *actual, type_T *expected);
|
||||
int need_type(type_T *actual, type_T *expected, int offset, int arg_idx, cctx_T *cctx, int silent, int actual_is_const);
|
||||
int func_needs_compiling(ufunc_T *ufunc, int profile);
|
||||
int get_script_item_idx(int sid, char_u *name, int check_writable, cctx_T *cctx);
|
||||
imported_T *find_imported(char_u *name, size_t len, cctx_T *cctx);
|
||||
imported_T *find_imported_in_script(char_u *name, size_t len, int sid);
|
||||
@@ -15,7 +16,7 @@ void error_white_both(char_u *op, int len);
|
||||
int assignment_len(char_u *p, int *heredoc);
|
||||
void vim9_declare_error(char_u *name);
|
||||
int check_vim9_unlet(char_u *name);
|
||||
int compile_def_function(ufunc_T *ufunc, int check_return_type, cctx_T *outer_cctx);
|
||||
int compile_def_function(ufunc_T *ufunc, int check_return_type, int profiling, cctx_T *outer_cctx);
|
||||
void set_function_type(ufunc_T *ufunc);
|
||||
void delete_instr(isn_T *isn);
|
||||
void unlink_def_function(ufunc_T *ufunc);
|
||||
|
||||
@@ -1577,7 +1577,7 @@ typedef struct svar_S svar_T;
|
||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||
typedef struct funccall_S funccall_T;
|
||||
|
||||
// values used for "uf_dfunc_idx"
|
||||
// values used for "uf_def_status"
|
||||
typedef enum {
|
||||
UF_NOT_COMPILED,
|
||||
UF_TO_BE_COMPILED,
|
||||
@@ -1899,6 +1899,18 @@ typedef struct sn_prl_S
|
||||
} sn_prl_T;
|
||||
|
||||
# define PRL_ITEM(si, idx) (((sn_prl_T *)(si)->sn_prl_ga.ga_data)[(idx)])
|
||||
|
||||
typedef struct {
|
||||
int pi_started_profiling;
|
||||
proftime_T pi_wait_start;
|
||||
proftime_T pi_call_start;
|
||||
} profinfo_T;
|
||||
|
||||
# else
|
||||
typedef struct
|
||||
{
|
||||
int dummy;
|
||||
} profinfo_T;
|
||||
# endif
|
||||
#else
|
||||
// dummy typedefs for use in function prototypes
|
||||
|
||||
@@ -183,4 +183,12 @@ func s:CheckIPv6Loopback()
|
||||
return v:false
|
||||
endfunc
|
||||
|
||||
" Command to check for not running under ASAN
|
||||
command CheckNotAsan call CheckNotAsan()
|
||||
func CheckNotAsan()
|
||||
if execute('version') =~# '-fsanitize=[a-z,]*\<address\>'
|
||||
throw 'Skipped: does not work with ASAN'
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -527,6 +527,7 @@ endfunc
|
||||
" Test for quitting Vim with unedited files in the argument list
|
||||
func Test_quit_with_arglist()
|
||||
CheckRunVimInTerminal
|
||||
|
||||
let buf = RunVimInTerminal('', {'rows': 6})
|
||||
call term_sendkeys(buf, ":set nomore\n")
|
||||
call term_sendkeys(buf, ":args a b c\n")
|
||||
@@ -559,4 +560,22 @@ func Test_quit_with_arglist()
|
||||
call delete('.c.swp')
|
||||
endfunc
|
||||
|
||||
" Test for ":all" not working when in the cmdline window
|
||||
func Test_all_not_allowed_from_cmdwin()
|
||||
CheckFeature cmdwin
|
||||
|
||||
au BufEnter * all
|
||||
next x
|
||||
" Use try/catch here, somehow assert_fails() doesn't work on MS-Windows
|
||||
" console.
|
||||
let caught = 'no'
|
||||
try
|
||||
exe ":norm! 7q?apat\<CR>"
|
||||
catch /E11:/
|
||||
let caught = 'yes'
|
||||
endtry
|
||||
call assert_equal('yes', caught)
|
||||
au! BufEnter
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -173,6 +173,12 @@ func Test_autocmd_bufunload_with_tabnext()
|
||||
quit
|
||||
endfunc
|
||||
|
||||
func Test_argdelete_in_next()
|
||||
au BufNew,BufEnter,BufLeave,BufWinEnter * argdel
|
||||
call assert_fails('next a b', 'E1156:')
|
||||
au! BufNew,BufEnter,BufLeave,BufWinEnter *
|
||||
endfunc
|
||||
|
||||
func Test_autocmd_bufwinleave_with_tabfirst()
|
||||
tabedit
|
||||
augroup sample
|
||||
@@ -214,7 +220,6 @@ func Test_autocmd_bufunload_avoiding_SEGV_02()
|
||||
|
||||
normal! i1
|
||||
call assert_fails('edit a.txt', 'E517:')
|
||||
call feedkeys("\<CR>")
|
||||
|
||||
autocmd! test_autocmd_bufunload
|
||||
augroup! test_autocmd_bufunload
|
||||
@@ -503,14 +508,6 @@ endfunc
|
||||
" Using :blast and :ball for many events caused a crash, because b_nwindows was
|
||||
" not incremented correctly.
|
||||
func Test_autocmd_blast_badd()
|
||||
" The system() here causes SetChangeMarks() to fail, when run in the GUI
|
||||
" under Windows. No idea why. Happens with any external command, not
|
||||
" related to the actual test.
|
||||
" TODO: find the cause
|
||||
if has('win32')
|
||||
throw 'Skipped: calling system() causes problems'
|
||||
endif
|
||||
|
||||
let content =<< trim [CODE]
|
||||
au BufNew,BufAdd,BufWinEnter,BufEnter,BufLeave,BufWinLeave,BufUnload,VimEnter foo* blast
|
||||
edit foo1
|
||||
@@ -1836,20 +1833,9 @@ func Test_TextYankPost()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_nocatch_wipe_all_buffers()
|
||||
" Real nasty autocommand: wipe all buffers on any event.
|
||||
au * * bwipe *
|
||||
call assert_fails('next x', ['E94:', 'E937:'])
|
||||
bwipe
|
||||
au!
|
||||
endfunc
|
||||
|
||||
func Test_nocatch_wipe_dummy_buffer()
|
||||
CheckFeature quickfix
|
||||
" Nasty autocommand: wipe buffer on any event.
|
||||
au * x bwipe
|
||||
call assert_fails('lv½ /x', 'E937:')
|
||||
au!
|
||||
func Test_autocommand_all_events()
|
||||
call assert_fails('au * * bwipe', 'E1155:')
|
||||
call assert_fails('au * x bwipe', 'E1155:')
|
||||
endfunc
|
||||
|
||||
function s:Before_test_dirchanged()
|
||||
@@ -2397,10 +2383,8 @@ endfunc
|
||||
|
||||
func Test_autocmd_CmdWinEnter()
|
||||
CheckRunVimInTerminal
|
||||
" There is not cmdwin switch, so
|
||||
" test for cmdline_hist
|
||||
" (both are available with small builds)
|
||||
CheckFeature cmdline_hist
|
||||
CheckFeature cmdwin
|
||||
|
||||
let lines =<< trim END
|
||||
let b:dummy_var = 'This is a dummy'
|
||||
autocmd CmdWinEnter * quit
|
||||
|
||||
@@ -129,7 +129,6 @@ func Test_wildmenu_screendump()
|
||||
endfunc
|
||||
|
||||
func Test_map_completion()
|
||||
CheckFeature cmdline_compl
|
||||
call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"map <unique> <silent>', getreg(':'))
|
||||
call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
|
||||
@@ -207,7 +206,6 @@ func Test_map_completion()
|
||||
endfunc
|
||||
|
||||
func Test_match_completion()
|
||||
CheckFeature cmdline_compl
|
||||
hi Aardig ctermfg=green
|
||||
call feedkeys(":match \<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"match Aardig', getreg(':'))
|
||||
@@ -216,7 +214,6 @@ func Test_match_completion()
|
||||
endfunc
|
||||
|
||||
func Test_highlight_completion()
|
||||
CheckFeature cmdline_compl
|
||||
hi Aardig ctermfg=green
|
||||
call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt')
|
||||
call assert_equal('"hi Aardig', getreg(':'))
|
||||
@@ -253,7 +250,6 @@ func Test_highlight_easter_egg()
|
||||
endfunc
|
||||
|
||||
func Test_getcompletion()
|
||||
CheckFeature cmdline_compl
|
||||
let groupcount = len(getcompletion('', 'event'))
|
||||
call assert_true(groupcount > 0)
|
||||
let matchcount = len('File'->getcompletion('event'))
|
||||
@@ -980,6 +976,8 @@ func Test_getcmdtype()
|
||||
endfunc
|
||||
|
||||
func Test_getcmdwintype()
|
||||
CheckFeature cmdwin
|
||||
|
||||
call feedkeys("q/:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
|
||||
call assert_equal('/', a)
|
||||
|
||||
@@ -996,6 +994,8 @@ func Test_getcmdwintype()
|
||||
endfunc
|
||||
|
||||
func Test_getcmdwin_autocmd()
|
||||
CheckFeature cmdwin
|
||||
|
||||
let s:seq = []
|
||||
augroup CmdWin
|
||||
au WinEnter * call add(s:seq, 'WinEnter ' .. win_getid())
|
||||
@@ -1108,6 +1108,8 @@ func Test_cmdline_overstrike()
|
||||
endfunc
|
||||
|
||||
func Test_cmdwin_bug()
|
||||
CheckFeature cmdwin
|
||||
|
||||
let winid = win_getid()
|
||||
sp
|
||||
try
|
||||
@@ -1118,6 +1120,7 @@ func Test_cmdwin_bug()
|
||||
endfunc
|
||||
|
||||
func Test_cmdwin_restore()
|
||||
CheckFeature cmdwin
|
||||
CheckScreendump
|
||||
|
||||
let lines =<< trim [SCRIPT]
|
||||
@@ -1193,6 +1196,8 @@ func Test_buffers_lastused()
|
||||
endfunc
|
||||
|
||||
func Test_cmdwin_feedkeys()
|
||||
CheckFeature cmdwin
|
||||
|
||||
" This should not generate E488
|
||||
call feedkeys("q:\<CR>", 'x')
|
||||
" Using feedkeys with q: only should automatically close the cmd window
|
||||
@@ -1204,6 +1209,8 @@ endfunc
|
||||
" Tests for the issues fixed in 7.4.441.
|
||||
" When 'cedit' is set to Ctrl-C, opening the command window hangs Vim
|
||||
func Test_cmdwin_cedit()
|
||||
CheckFeature cmdwin
|
||||
|
||||
exe "set cedit=\<C-c>"
|
||||
normal! :
|
||||
call assert_equal(1, winnr('$'))
|
||||
@@ -1226,6 +1233,8 @@ endfunc
|
||||
|
||||
" Test for CmdwinEnter autocmd
|
||||
func Test_cmdwin_autocmd()
|
||||
CheckFeature cmdwin
|
||||
|
||||
augroup CmdWin
|
||||
au!
|
||||
autocmd CmdwinEnter * startinsert
|
||||
@@ -1268,6 +1277,8 @@ func Test_cmdline_expand_special()
|
||||
endfunc
|
||||
|
||||
func Test_cmdwin_jump_to_win()
|
||||
CheckFeature cmdwin
|
||||
|
||||
call assert_fails('call feedkeys("q:\<C-W>\<C-W>\<CR>", "xt")', 'E11:')
|
||||
new
|
||||
set modified
|
||||
@@ -1284,6 +1295,7 @@ func Test_cmdwin_jump_to_win()
|
||||
endfunc
|
||||
|
||||
func Test_cmdwin_interrupted()
|
||||
CheckFeature cmdwin
|
||||
CheckScreendump
|
||||
|
||||
" aborting the :smile output caused the cmdline window to use the current
|
||||
@@ -1570,6 +1582,8 @@ endfunc
|
||||
|
||||
" Test for recursively getting multiple command line inputs
|
||||
func Test_cmdwin_multi_input()
|
||||
CheckFeature cmdwin
|
||||
|
||||
call feedkeys(":\<C-R>=input('P: ')\<CR>\"cyan\<CR>\<CR>", 'xt')
|
||||
call assert_equal('"cyan', @:)
|
||||
endfunc
|
||||
@@ -1594,6 +1608,8 @@ endfunc
|
||||
|
||||
" Test for normal mode commands not supported in the cmd window
|
||||
func Test_cmdwin_blocked_commands()
|
||||
CheckFeature cmdwin
|
||||
|
||||
call assert_fails('call feedkeys("q:\<C-T>\<CR>", "xt")', 'E11:')
|
||||
call assert_fails('call feedkeys("q:\<C-]>\<CR>", "xt")', 'E11:')
|
||||
call assert_fails('call feedkeys("q:\<C-^>\<CR>", "xt")', 'E11:')
|
||||
@@ -1625,6 +1641,8 @@ endfunc
|
||||
|
||||
" Close the Cmd-line window in insert mode using CTRL-C
|
||||
func Test_cmdwin_insert_mode_close()
|
||||
CheckFeature cmdwin
|
||||
|
||||
%bw!
|
||||
let s = ''
|
||||
exe "normal q:a\<C-C>let s='Hello'\<CR>"
|
||||
|
||||
@@ -68,6 +68,11 @@ func Test_for_invalid()
|
||||
call assert_fails("for x in 99", 'E714:')
|
||||
call assert_fails("for x in 'asdf'", 'E714:')
|
||||
call assert_fails("for x in {'a': 9}", 'E714:')
|
||||
|
||||
if 0
|
||||
/1/5/2/s/\n
|
||||
endif
|
||||
redraw
|
||||
endfunc
|
||||
|
||||
func Test_readfile_binary()
|
||||
|
||||
@@ -206,4 +206,23 @@ func Test_ex_mode_with_global()
|
||||
call delete('Xexmodescript')
|
||||
endfunc
|
||||
|
||||
func Test_ex_mode_count_overflow()
|
||||
" The multiplication causes an integer overflow
|
||||
CheckNotAsan
|
||||
|
||||
" this used to cause a crash
|
||||
let lines =<< trim END
|
||||
call feedkeys("\<Esc>Q\<CR>")
|
||||
v9|9silent! vi|333333233333y32333333%O
|
||||
call writefile(['done'], 'Xdidexmode')
|
||||
qall!
|
||||
END
|
||||
call writefile(lines, 'Xexmodescript')
|
||||
call assert_equal(1, RunVim([], [], '-e -s -S Xexmodescript -c qa'))
|
||||
call assert_equal(['done'], readfile('Xdidexmode'))
|
||||
|
||||
call delete('Xdidexmode')
|
||||
call delete('Xexmodescript')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -162,6 +162,7 @@ let s:filename_checks = {
|
||||
\ 'elinks': ['elinks.conf'],
|
||||
\ 'elm': ['file.elm'],
|
||||
\ 'elmfilt': ['filter-rules'],
|
||||
\ 'epuppet': ['file.epp'],
|
||||
\ 'erlang': ['file.erl', 'file.hrl', 'file.yaws'],
|
||||
\ 'eruby': ['file.erb', 'file.rhtml'],
|
||||
\ 'esmtprc': ['anyesmtprc', 'esmtprc', 'some-esmtprc'],
|
||||
@@ -391,6 +392,7 @@ let s:filename_checks = {
|
||||
\ 'quake': ['anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg', 'baseq2/file.cfg', 'id1/file.cfg', 'quake1/file.cfg', 'some-baseq2/file.cfg', 'some-id1/file.cfg', 'some-quake1/file.cfg'],
|
||||
\ 'radiance': ['file.rad', 'file.mat'],
|
||||
\ 'ratpoison': ['.ratpoisonrc', 'ratpoisonrc'],
|
||||
\ 'rbs': ['file.rbs'],
|
||||
\ 'rc': ['file.rc', 'file.rch'],
|
||||
\ 'rcs': ['file,v'],
|
||||
\ 'readline': ['.inputrc', 'inputrc'],
|
||||
@@ -407,7 +409,7 @@ let s:filename_checks = {
|
||||
\ 'rpl': ['file.rpl'],
|
||||
\ 'rst': ['file.rst'],
|
||||
\ 'rtf': ['file.rtf'],
|
||||
\ 'ruby': ['.irbrc', 'irbrc', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file'],
|
||||
\ 'ruby': ['.irbrc', 'irbrc', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file', 'Puppetfile'],
|
||||
\ 'rust': ['file.rs'],
|
||||
\ 'samba': ['smb.conf'],
|
||||
\ 'sas': ['file.sas'],
|
||||
|
||||
@@ -343,6 +343,8 @@ func Test_compl_feedkeys()
|
||||
endfunc
|
||||
|
||||
func Test_compl_in_cmdwin()
|
||||
CheckFeature cmdwin
|
||||
|
||||
set wildmenu wildchar=<Tab>
|
||||
com! -nargs=1 -complete=command GetInput let input = <q-args>
|
||||
com! -buffer TestCommand echo 'TestCommand'
|
||||
@@ -560,27 +562,33 @@ func Test_completefunc_error()
|
||||
call setline(1, ['', 'abcd', ''])
|
||||
call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E578:')
|
||||
|
||||
" Jump to a different window from the complete function
|
||||
" TODO: The following test causes an ASAN failure. Once this issue is
|
||||
" addressed, enable the following test.
|
||||
"func! CompleteFunc(findstart, base)
|
||||
" if a:findstart == 1
|
||||
" return col('.') - 1
|
||||
" endif
|
||||
" wincmd p
|
||||
" return ['a', 'b']
|
||||
"endfunc
|
||||
"set completefunc=CompleteFunc
|
||||
"new
|
||||
"call assert_fails('exe "normal a\<C-X>\<C-U>"', 'E839:')
|
||||
"close!
|
||||
|
||||
set completefunc&
|
||||
delfunc CompleteFunc
|
||||
delfunc CompleteFunc2
|
||||
close!
|
||||
endfunc
|
||||
|
||||
func Test_completefunc_error_not_asan()
|
||||
" The following test causes an ASAN failure.
|
||||
CheckNotAsan
|
||||
|
||||
" Jump to a different window from the complete function
|
||||
func! CompleteFunc(findstart, base)
|
||||
if a:findstart == 1
|
||||
return col('.') - 1
|
||||
endif
|
||||
wincmd p
|
||||
return ['a', 'b']
|
||||
endfunc
|
||||
set completefunc=CompleteFunc
|
||||
new
|
||||
call assert_fails('exe "normal a\<C-X>\<C-U>"', 'E839:')
|
||||
close!
|
||||
|
||||
set completefunc&
|
||||
delfunc CompleteFunc
|
||||
endfunc
|
||||
|
||||
" Test for returning non-string values from 'completefunc'
|
||||
func Test_completefunc_invalid_data()
|
||||
new
|
||||
|
||||
@@ -4,11 +4,9 @@ source check.vim
|
||||
CheckFeature terminal
|
||||
CheckNotGui
|
||||
|
||||
if execute('version') =~# '-fsanitize=[a-z,]*\<address\>'
|
||||
" Skip tests on Travis CI ASAN build because it's difficult to estimate
|
||||
" memory usage.
|
||||
throw 'Skipped: does not work with ASAN'
|
||||
endif
|
||||
" Skip tests on Travis CI ASAN build because it's difficult to estimate memory
|
||||
" usage.
|
||||
CheckNotAsan
|
||||
|
||||
source shared.vim
|
||||
|
||||
|
||||
@@ -2584,9 +2584,11 @@ func Test_normal40_ctrl_bsl()
|
||||
call assert_false(&insertmode)
|
||||
call assert_beeps("normal! \<C-\>\<C-A>", 'xt')
|
||||
|
||||
" Using CTRL-\ CTRL-N in cmd window should close the window
|
||||
call feedkeys("q:\<C-\>\<C-N>", 'xt')
|
||||
call assert_equal('', getcmdwintype())
|
||||
if has('cmdwin')
|
||||
" Using CTRL-\ CTRL-N in cmd window should close the window
|
||||
call feedkeys("q:\<C-\>\<C-N>", 'xt')
|
||||
call assert_equal('', getcmdwintype())
|
||||
endif
|
||||
|
||||
" clean up
|
||||
bw!
|
||||
|
||||
@@ -5,24 +5,30 @@ CheckFeature profile
|
||||
|
||||
source shared.vim
|
||||
source screendump.vim
|
||||
source vim9.vim
|
||||
|
||||
func Test_profile_func()
|
||||
call RunProfileFunc('func', 'let', 'let')
|
||||
call RunProfileFunc('def', 'var', '')
|
||||
endfunc
|
||||
|
||||
func RunProfileFunc(command, declare, assign)
|
||||
let lines =<< trim [CODE]
|
||||
profile start Xprofile_func.log
|
||||
profile func Foo*
|
||||
func! Foo1()
|
||||
endfunc
|
||||
func! Foo2()
|
||||
let l:count = 100
|
||||
while l:count > 0
|
||||
let l:count = l:count - 1
|
||||
XXX Foo1()
|
||||
endXXX
|
||||
XXX Foo2()
|
||||
DDD counter = 100
|
||||
while counter > 0
|
||||
AAA counter = counter - 1
|
||||
endwhile
|
||||
sleep 1m
|
||||
endfunc
|
||||
func! Foo3()
|
||||
endfunc
|
||||
func! Bar()
|
||||
endfunc
|
||||
endXXX
|
||||
XXX Foo3()
|
||||
endXXX
|
||||
XXX Bar()
|
||||
endXXX
|
||||
call Foo1()
|
||||
call Foo1()
|
||||
profile pause
|
||||
@@ -37,6 +43,10 @@ func Test_profile_func()
|
||||
delfunc Foo3
|
||||
[CODE]
|
||||
|
||||
call map(lines, {k, v -> substitute(v, 'XXX', a:command, '') })
|
||||
call map(lines, {k, v -> substitute(v, 'DDD', a:declare, '') })
|
||||
call map(lines, {k, v -> substitute(v, 'AAA', a:assign, '') })
|
||||
|
||||
call writefile(lines, 'Xprofile_func.vim')
|
||||
call system(GetVimCommand()
|
||||
\ . ' -es --clean'
|
||||
@@ -69,10 +79,10 @@ func Test_profile_func()
|
||||
call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[12])
|
||||
call assert_equal('', lines[13])
|
||||
call assert_equal('count total (s) self (s)', lines[14])
|
||||
call assert_match('^\s*1\s\+.*\slet l:count = 100$', lines[15])
|
||||
call assert_match('^\s*101\s\+.*\swhile l:count > 0$', lines[16])
|
||||
call assert_match('^\s*100\s\+.*\s let l:count = l:count - 1$', lines[17])
|
||||
call assert_match('^\s*101\s\+.*\sendwhile$', lines[18])
|
||||
call assert_match('^\s*1\s\+.*\s\(let\|var\) counter = 100$', lines[15])
|
||||
call assert_match('^\s*101\s\+.*\swhile counter > 0$', lines[16])
|
||||
call assert_match('^\s*100\s\+.*\s \(let\)\= counter = counter - 1$', lines[17])
|
||||
call assert_match('^\s*10[01]\s\+.*\sendwhile$', lines[18])
|
||||
call assert_match('^\s*1\s\+.\+sleep 1m$', lines[19])
|
||||
call assert_equal('', lines[20])
|
||||
call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[21])
|
||||
@@ -91,39 +101,47 @@ func Test_profile_func()
|
||||
endfunc
|
||||
|
||||
func Test_profile_func_with_ifelse()
|
||||
call Run_profile_func_with_ifelse('func', 'let')
|
||||
call Run_profile_func_with_ifelse('def', 'var')
|
||||
endfunc
|
||||
|
||||
func Run_profile_func_with_ifelse(command, declare)
|
||||
let lines =<< trim [CODE]
|
||||
func! Foo1()
|
||||
XXX Foo1()
|
||||
if 1
|
||||
let x = 0
|
||||
DDD x = 0
|
||||
elseif 1
|
||||
let x = 1
|
||||
DDD x = 1
|
||||
else
|
||||
let x = 2
|
||||
DDD x = 2
|
||||
endif
|
||||
endfunc
|
||||
func! Foo2()
|
||||
endXXX
|
||||
XXX Foo2()
|
||||
if 0
|
||||
let x = 0
|
||||
DDD x = 0
|
||||
elseif 1
|
||||
let x = 1
|
||||
DDD x = 1
|
||||
else
|
||||
let x = 2
|
||||
DDD x = 2
|
||||
endif
|
||||
endfunc
|
||||
func! Foo3()
|
||||
endXXX
|
||||
XXX Foo3()
|
||||
if 0
|
||||
let x = 0
|
||||
DDD x = 0
|
||||
elseif 0
|
||||
let x = 1
|
||||
DDD x = 1
|
||||
else
|
||||
let x = 2
|
||||
DDD x = 2
|
||||
endif
|
||||
endfunc
|
||||
endXXX
|
||||
call Foo1()
|
||||
call Foo2()
|
||||
call Foo3()
|
||||
[CODE]
|
||||
|
||||
call map(lines, {k, v -> substitute(v, 'XXX', a:command, '') })
|
||||
call map(lines, {k, v -> substitute(v, 'DDD', a:declare, '') })
|
||||
|
||||
call writefile(lines, 'Xprofile_func.vim')
|
||||
call system(GetVimCommand()
|
||||
\ . ' -es -i NONE --noplugin'
|
||||
@@ -148,11 +166,11 @@ func Test_profile_func_with_ifelse()
|
||||
call assert_equal('', lines[5])
|
||||
call assert_equal('count total (s) self (s)', lines[6])
|
||||
call assert_match('^\s*1\s\+.*\sif 1$', lines[7])
|
||||
call assert_match('^\s*1\s\+.*\s let x = 0$', lines[8])
|
||||
call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 0$', lines[8])
|
||||
call assert_match( '^\s\+elseif 1$', lines[9])
|
||||
call assert_match( '^\s\+let x = 1$', lines[10])
|
||||
call assert_match( '^\s\+\(let\|var\) x = 1$', lines[10])
|
||||
call assert_match( '^\s\+else$', lines[11])
|
||||
call assert_match( '^\s\+let x = 2$', lines[12])
|
||||
call assert_match( '^\s\+\(let\|var\) x = 2$', lines[12])
|
||||
call assert_match('^\s*1\s\+.*\sendif$', lines[13])
|
||||
call assert_equal('', lines[14])
|
||||
call assert_equal('FUNCTION Foo2()', lines[15])
|
||||
@@ -162,11 +180,11 @@ func Test_profile_func_with_ifelse()
|
||||
call assert_equal('', lines[20])
|
||||
call assert_equal('count total (s) self (s)', lines[21])
|
||||
call assert_match('^\s*1\s\+.*\sif 0$', lines[22])
|
||||
call assert_match( '^\s\+let x = 0$', lines[23])
|
||||
call assert_match( '^\s\+\(let\|var\) x = 0$', lines[23])
|
||||
call assert_match('^\s*1\s\+.*\selseif 1$', lines[24])
|
||||
call assert_match('^\s*1\s\+.*\s let x = 1$', lines[25])
|
||||
call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 1$', lines[25])
|
||||
call assert_match( '^\s\+else$', lines[26])
|
||||
call assert_match( '^\s\+let x = 2$', lines[27])
|
||||
call assert_match( '^\s\+\(let\|var\) x = 2$', lines[27])
|
||||
call assert_match('^\s*1\s\+.*\sendif$', lines[28])
|
||||
call assert_equal('', lines[29])
|
||||
call assert_equal('FUNCTION Foo3()', lines[30])
|
||||
@@ -176,11 +194,11 @@ func Test_profile_func_with_ifelse()
|
||||
call assert_equal('', lines[35])
|
||||
call assert_equal('count total (s) self (s)', lines[36])
|
||||
call assert_match('^\s*1\s\+.*\sif 0$', lines[37])
|
||||
call assert_match( '^\s\+let x = 0$', lines[38])
|
||||
call assert_match( '^\s\+\(let\|var\) x = 0$', lines[38])
|
||||
call assert_match('^\s*1\s\+.*\selseif 0$', lines[39])
|
||||
call assert_match( '^\s\+let x = 1$', lines[40])
|
||||
call assert_match( '^\s\+\(let\|var\) x = 1$', lines[40])
|
||||
call assert_match('^\s*1\s\+.*\selse$', lines[41])
|
||||
call assert_match('^\s*1\s\+.*\s let x = 2$', lines[42])
|
||||
call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 2$', lines[42])
|
||||
call assert_match('^\s*1\s\+.*\sendif$', lines[43])
|
||||
call assert_equal('', lines[44])
|
||||
call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[45])
|
||||
@@ -201,42 +219,56 @@ func Test_profile_func_with_ifelse()
|
||||
endfunc
|
||||
|
||||
func Test_profile_func_with_trycatch()
|
||||
call Run_profile_func_with_trycatch('func', 'let')
|
||||
call Run_profile_func_with_trycatch('def', 'var')
|
||||
endfunc
|
||||
|
||||
func Run_profile_func_with_trycatch(command, declare)
|
||||
let lines =<< trim [CODE]
|
||||
func! Foo1()
|
||||
XXX Foo1()
|
||||
try
|
||||
let x = 0
|
||||
DDD x = 0
|
||||
catch
|
||||
let x = 1
|
||||
DDD x = 1
|
||||
finally
|
||||
let x = 2
|
||||
DDD x = 2
|
||||
endtry
|
||||
endfunc
|
||||
func! Foo2()
|
||||
endXXX
|
||||
XXX Foo2()
|
||||
try
|
||||
throw 0
|
||||
catch
|
||||
let x = 1
|
||||
DDD x = 1
|
||||
finally
|
||||
let x = 2
|
||||
DDD x = 2
|
||||
endtry
|
||||
endfunc
|
||||
func! Foo3()
|
||||
endXXX
|
||||
XXX Foo3()
|
||||
try
|
||||
throw 0
|
||||
catch
|
||||
throw 1
|
||||
finally
|
||||
let x = 2
|
||||
DDD x = 2
|
||||
endtry
|
||||
endfunc
|
||||
endXXX
|
||||
call Foo1()
|
||||
call Foo2()
|
||||
let rethrown = 0
|
||||
try
|
||||
call Foo3()
|
||||
catch
|
||||
let rethrown = 1
|
||||
endtry
|
||||
if rethrown != 1
|
||||
" call Foo1 again so that the test fails
|
||||
call Foo1()
|
||||
endif
|
||||
[CODE]
|
||||
|
||||
call map(lines, {k, v -> substitute(v, 'XXX', a:command, '') })
|
||||
call map(lines, {k, v -> substitute(v, 'DDD', a:declare, '') })
|
||||
|
||||
call writefile(lines, 'Xprofile_func.vim')
|
||||
call system(GetVimCommand()
|
||||
\ . ' -es -i NONE --noplugin'
|
||||
@@ -261,11 +293,11 @@ func Test_profile_func_with_trycatch()
|
||||
call assert_equal('', lines[5])
|
||||
call assert_equal('count total (s) self (s)', lines[6])
|
||||
call assert_match('^\s*1\s\+.*\stry$', lines[7])
|
||||
call assert_match('^\s*1\s\+.*\s let x = 0$', lines[8])
|
||||
call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 0$', lines[8])
|
||||
call assert_match( '^\s\+catch$', lines[9])
|
||||
call assert_match( '^\s\+let x = 1$', lines[10])
|
||||
call assert_match( '^\s\+\(let\|var\) x = 1$', lines[10])
|
||||
call assert_match('^\s*1\s\+.*\sfinally$', lines[11])
|
||||
call assert_match('^\s*1\s\+.*\s let x = 2$', lines[12])
|
||||
call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 2$', lines[12])
|
||||
call assert_match('^\s*1\s\+.*\sendtry$', lines[13])
|
||||
call assert_equal('', lines[14])
|
||||
call assert_equal('FUNCTION Foo2()', lines[15])
|
||||
@@ -277,9 +309,9 @@ func Test_profile_func_with_trycatch()
|
||||
call assert_match('^\s*1\s\+.*\stry$', lines[22])
|
||||
call assert_match('^\s*1\s\+.*\s throw 0$', lines[23])
|
||||
call assert_match('^\s*1\s\+.*\scatch$', lines[24])
|
||||
call assert_match('^\s*1\s\+.*\s let x = 1$', lines[25])
|
||||
call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 1$', lines[25])
|
||||
call assert_match('^\s*1\s\+.*\sfinally$', lines[26])
|
||||
call assert_match('^\s*1\s\+.*\s let x = 2$', lines[27])
|
||||
call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 2$', lines[27])
|
||||
call assert_match('^\s*1\s\+.*\sendtry$', lines[28])
|
||||
call assert_equal('', lines[29])
|
||||
call assert_equal('FUNCTION Foo3()', lines[30])
|
||||
@@ -293,7 +325,7 @@ func Test_profile_func_with_trycatch()
|
||||
call assert_match('^\s*1\s\+.*\scatch$', lines[39])
|
||||
call assert_match('^\s*1\s\+.*\s throw 1$', lines[40])
|
||||
call assert_match('^\s*1\s\+.*\sfinally$', lines[41])
|
||||
call assert_match('^\s*1\s\+.*\s let x = 2$', lines[42])
|
||||
call assert_match('^\s*1\s\+.*\s \(let\|var\) x = 2$', lines[42])
|
||||
call assert_match( '^\s\+endtry$', lines[43])
|
||||
call assert_equal('', lines[44])
|
||||
call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[45])
|
||||
@@ -552,4 +584,26 @@ func Test_profile_typed_func()
|
||||
call delete('XtestProfile')
|
||||
endfunc
|
||||
|
||||
func Test_vim9_profiling()
|
||||
" only tests that compiling and calling functions doesn't crash
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
def Func()
|
||||
Crash()
|
||||
enddef
|
||||
def Crash()
|
||||
enddef
|
||||
prof start Xprofile_crash.log
|
||||
prof func Func
|
||||
Func()
|
||||
END
|
||||
call writefile(lines, 'Xprofile_crash.vim')
|
||||
call system(GetVimCommandClean() . ' -es -c "so Xprofile_crash.vim" -c q')
|
||||
call assert_equal(0, v:shell_error)
|
||||
call CheckScriptSuccess(lines)
|
||||
call delete('Xprofile_crash.vim')
|
||||
call delete('Xprofile_crash.log')
|
||||
endfunc
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -3833,7 +3833,7 @@ func Test_lbuffer_crash()
|
||||
sv Xtest
|
||||
augroup QF_Test
|
||||
au!
|
||||
au * * bw
|
||||
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * bw
|
||||
augroup END
|
||||
lbuffer
|
||||
augroup QF_Test
|
||||
@@ -3845,7 +3845,7 @@ endfunc
|
||||
func Test_lexpr_crash()
|
||||
augroup QF_Test
|
||||
au!
|
||||
au * * call setloclist(0, [], 'f')
|
||||
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * call setloclist(0, [], 'f')
|
||||
augroup END
|
||||
lexpr ""
|
||||
augroup QF_Test
|
||||
@@ -3880,7 +3880,7 @@ func Test_lvimgrep_crash()
|
||||
sv Xtest
|
||||
augroup QF_Test
|
||||
au!
|
||||
au * * call setloclist(0, [], 'f')
|
||||
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * call setloclist(0, [], 'f')
|
||||
augroup END
|
||||
lvimgrep quickfix test_quickfix.vim
|
||||
augroup QF_Test
|
||||
@@ -4215,7 +4215,7 @@ func Test_lbuffer_with_bwipe()
|
||||
new
|
||||
new
|
||||
augroup nasty
|
||||
au * * bwipe
|
||||
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * bwipe
|
||||
augroup END
|
||||
lbuffer
|
||||
augroup nasty
|
||||
@@ -4228,9 +4228,9 @@ endfunc
|
||||
func Xexpr_acmd_freelist(cchar)
|
||||
call s:setup_commands(a:cchar)
|
||||
|
||||
" This was using freed memory.
|
||||
" This was using freed memory (but with what events?)
|
||||
augroup nasty
|
||||
au * * call g:Xsetlist([], 'f')
|
||||
au QuickFixCmdPre,QuickFixCmdPost,BufEnter,BufLeave * call g:Xsetlist([], 'f')
|
||||
augroup END
|
||||
Xexpr "x"
|
||||
augroup nasty
|
||||
|
||||
@@ -617,6 +617,8 @@ endfunc
|
||||
|
||||
" Test for closing the tab page from a command window
|
||||
func Test_tabpage_close_cmdwin()
|
||||
CheckFeature cmdwin
|
||||
|
||||
tabnew
|
||||
call feedkeys("q/:tabclose\<CR>\<Esc>", 'xt')
|
||||
call assert_equal(2, tabpagenr('$'))
|
||||
|
||||
@@ -367,6 +367,8 @@ endfunc
|
||||
|
||||
" Test for using the mouse to increaes the height of the cmdline window
|
||||
func Test_mouse_cmdwin_resize()
|
||||
CheckFeature cmdwin
|
||||
|
||||
let save_mouse = &mouse
|
||||
let save_term = &term
|
||||
let save_ttymouse = &ttymouse
|
||||
|
||||
@@ -1842,6 +1842,30 @@ def Test_silent()
|
||||
res)
|
||||
enddef
|
||||
|
||||
def s:Profiled(): string
|
||||
echo "profiled"
|
||||
return "done"
|
||||
enddef
|
||||
|
||||
def Test_profiled()
|
||||
if !has('profile')
|
||||
MissingFeature 'profile'
|
||||
endif
|
||||
var res = execute('disass! s:Profiled')
|
||||
assert_match('<SNR>\d*_Profiled\_s*' ..
|
||||
'echo "profiled"\_s*' ..
|
||||
'\d PROFILE START line 1\_s*' ..
|
||||
'\d PUSHS "profiled"\_s*' ..
|
||||
'\d ECHO 1\_s*' ..
|
||||
'return "done"\_s*' ..
|
||||
'\d PROFILE END\_s*' ..
|
||||
'\d PROFILE START line 2\_s*' ..
|
||||
'\d PUSHS "done"\_s*' ..
|
||||
'\d RETURN\_s*' ..
|
||||
'\d PROFILE END',
|
||||
res)
|
||||
enddef
|
||||
|
||||
def s:SilentReturn(): string
|
||||
silent return "done"
|
||||
enddef
|
||||
|
||||
@@ -116,6 +116,38 @@ def Test_missing_endfunc_enddef()
|
||||
CheckScriptFailure(lines, 'E126:', 2)
|
||||
enddef
|
||||
|
||||
def Test_white_space_before_paren()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
def Test ()
|
||||
echo 'test'
|
||||
enddef
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1068:', 2)
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
func Test ()
|
||||
echo 'test'
|
||||
endfunc
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1068:', 2)
|
||||
|
||||
lines =<< trim END
|
||||
def Test ()
|
||||
echo 'test'
|
||||
enddef
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1068:', 1)
|
||||
|
||||
lines =<< trim END
|
||||
func Test ()
|
||||
echo 'test'
|
||||
endfunc
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_enddef_dict_key()
|
||||
var d = {
|
||||
enddef: 'x',
|
||||
|
||||
@@ -1741,7 +1741,7 @@ def Test_if_elseif_else_fails()
|
||||
CheckDefFailure(['elseif true'], 'E582:')
|
||||
CheckDefFailure(['else'], 'E581:')
|
||||
CheckDefFailure(['endif'], 'E580:')
|
||||
CheckDefFailure(['if true', 'elseif xxx'], 'E1001:')
|
||||
CheckDefFailure(['if g:abool', 'elseif xxx'], 'E1001:')
|
||||
CheckDefFailure(['if true', 'echo 1'], 'E171:')
|
||||
enddef
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ func Test_window_cmd_ls0_with_split()
|
||||
endfunc
|
||||
|
||||
func Test_window_cmd_cmdwin_with_vsp()
|
||||
CheckFeature cmdwin
|
||||
|
||||
let efmt = 'Expected 0 but got %d (in ls=%d, %s window)'
|
||||
for v in range(0, 2)
|
||||
exec "set ls=" . v
|
||||
@@ -565,8 +567,8 @@ endfunc
|
||||
|
||||
func Test_access_freed_mem()
|
||||
call assert_equal(&columns, winwidth(0))
|
||||
" This was accessing freed memory
|
||||
au * 0 vs xxx
|
||||
" This was accessing freed memory (but with what events?)
|
||||
au BufEnter,BufLeave,WinEnter,WinLeave 0 vs xxx
|
||||
arg 0
|
||||
argadd
|
||||
call assert_fails("all", "E242:")
|
||||
|
||||
@@ -1601,12 +1601,14 @@ call_user_func(
|
||||
char_u numbuf[NUMBUFLEN];
|
||||
char_u *name;
|
||||
#ifdef FEAT_PROFILE
|
||||
proftime_T wait_start;
|
||||
proftime_T call_start;
|
||||
int started_profiling = FALSE;
|
||||
profinfo_T profile_info;
|
||||
#endif
|
||||
ESTACK_CHECK_DECLARATION
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
CLEAR_FIELD(profile_info);
|
||||
#endif
|
||||
|
||||
// If depth of calling is getting too high, don't execute the function.
|
||||
if (funcdepth_increment() == FAIL)
|
||||
{
|
||||
@@ -1635,8 +1637,16 @@ call_user_func(
|
||||
if (fp->uf_def_status != UF_NOT_COMPILED)
|
||||
{
|
||||
// Execute the function, possibly compiling it first.
|
||||
#ifdef FEAT_PROFILE
|
||||
profile_may_start_func(&profile_info, fp, fc);
|
||||
#endif
|
||||
call_def_function(fp, argcount, argvars, funcexe->partial, rettv);
|
||||
funcdepth_decrement();
|
||||
#ifdef FEAT_PROFILE
|
||||
if (do_profiling == PROF_YES && (fp->uf_profiling
|
||||
|| (fc->caller != NULL && fc->caller->func->uf_profiling)))
|
||||
profile_may_end_func(&profile_info, fp, fc);
|
||||
#endif
|
||||
current_funccal = fc->caller;
|
||||
free_funccal(fc);
|
||||
return;
|
||||
@@ -1849,22 +1859,7 @@ call_user_func(
|
||||
--no_wait_return;
|
||||
}
|
||||
#ifdef FEAT_PROFILE
|
||||
if (do_profiling == PROF_YES)
|
||||
{
|
||||
if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
|
||||
{
|
||||
started_profiling = TRUE;
|
||||
func_do_profile(fp);
|
||||
}
|
||||
if (fp->uf_profiling
|
||||
|| (fc->caller != NULL && fc->caller->func->uf_profiling))
|
||||
{
|
||||
++fp->uf_tm_count;
|
||||
profile_start(&call_start);
|
||||
profile_zero(&fp->uf_tm_children);
|
||||
}
|
||||
script_prof_save(&wait_start);
|
||||
}
|
||||
profile_may_start_func(&profile_info, fp, fc);
|
||||
#endif
|
||||
|
||||
save_current_sctx = current_sctx;
|
||||
@@ -1902,20 +1897,7 @@ call_user_func(
|
||||
#ifdef FEAT_PROFILE
|
||||
if (do_profiling == PROF_YES && (fp->uf_profiling
|
||||
|| (fc->caller != NULL && fc->caller->func->uf_profiling)))
|
||||
{
|
||||
profile_end(&call_start);
|
||||
profile_sub_wait(&wait_start, &call_start);
|
||||
profile_add(&fp->uf_tm_total, &call_start);
|
||||
profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
|
||||
if (fc->caller != NULL && fc->caller->func->uf_profiling)
|
||||
{
|
||||
profile_add(&fc->caller->func->uf_tm_children, &call_start);
|
||||
profile_add(&fc->caller->func->uf_tml_children, &call_start);
|
||||
}
|
||||
if (started_profiling)
|
||||
// make a ":profdel func" stop profiling the function
|
||||
fp->uf_profiling = FALSE;
|
||||
}
|
||||
profile_may_end_func(&profile_info, fp, fc);
|
||||
#endif
|
||||
|
||||
// when being verbose, mention the return value
|
||||
@@ -1964,7 +1946,7 @@ call_user_func(
|
||||
current_sctx = save_current_sctx;
|
||||
#ifdef FEAT_PROFILE
|
||||
if (do_profiling == PROF_YES)
|
||||
script_prof_restore(&wait_start);
|
||||
script_prof_restore(&profile_info.pi_wait_start);
|
||||
#endif
|
||||
if (using_sandbox)
|
||||
--sandbox;
|
||||
@@ -3217,6 +3199,12 @@ define_function(exarg_T *eap, char_u *name_arg)
|
||||
p = vim_strchr(p, '(');
|
||||
}
|
||||
|
||||
if ((vim9script || eap->cmdidx == CMD_def) && VIM_ISWHITE(p[-1]))
|
||||
{
|
||||
semsg(_(e_no_white_space_allowed_before_str), "(");
|
||||
goto ret_free;
|
||||
}
|
||||
|
||||
// In Vim9 script only global functions can be redefined.
|
||||
if (vim9script && eap->forceit && !is_global)
|
||||
{
|
||||
@@ -3982,7 +3970,7 @@ ex_function(exarg_T *eap)
|
||||
|
||||
/*
|
||||
* :defcompile - compile all :def functions in the current script that need to
|
||||
* be compiled. Except dead functions.
|
||||
* be compiled. Except dead functions. Doesn't do profiling.
|
||||
*/
|
||||
void
|
||||
ex_defcompile(exarg_T *eap UNUSED)
|
||||
@@ -4002,7 +3990,7 @@ ex_defcompile(exarg_T *eap UNUSED)
|
||||
&& ufunc->uf_def_status == UF_TO_BE_COMPILED
|
||||
&& (ufunc->uf_flags & FC_DEAD) == 0)
|
||||
{
|
||||
compile_def_function(ufunc, FALSE, NULL);
|
||||
compile_def_function(ufunc, FALSE, FALSE, NULL);
|
||||
|
||||
if (func_hashtab.ht_changed != changed)
|
||||
{
|
||||
@@ -4698,7 +4686,7 @@ get_func_line(
|
||||
SOURCING_LNUM = fcp->linenr;
|
||||
#ifdef FEAT_PROFILE
|
||||
if (do_profiling == PROF_YES)
|
||||
func_line_start(cookie);
|
||||
func_line_start(cookie, SOURCING_LNUM);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,6 +750,58 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2425,
|
||||
/**/
|
||||
2424,
|
||||
/**/
|
||||
2423,
|
||||
/**/
|
||||
2422,
|
||||
/**/
|
||||
2421,
|
||||
/**/
|
||||
2420,
|
||||
/**/
|
||||
2419,
|
||||
/**/
|
||||
2418,
|
||||
/**/
|
||||
2417,
|
||||
/**/
|
||||
2416,
|
||||
/**/
|
||||
2415,
|
||||
/**/
|
||||
2414,
|
||||
/**/
|
||||
2413,
|
||||
/**/
|
||||
2412,
|
||||
/**/
|
||||
2411,
|
||||
/**/
|
||||
2410,
|
||||
/**/
|
||||
2409,
|
||||
/**/
|
||||
2408,
|
||||
/**/
|
||||
2407,
|
||||
/**/
|
||||
2406,
|
||||
/**/
|
||||
2405,
|
||||
/**/
|
||||
2404,
|
||||
/**/
|
||||
2403,
|
||||
/**/
|
||||
2402,
|
||||
/**/
|
||||
2401,
|
||||
/**/
|
||||
2400,
|
||||
/**/
|
||||
2399,
|
||||
/**/
|
||||
|
||||
21
src/vim9.h
21
src/vim9.h
@@ -152,6 +152,9 @@ typedef enum {
|
||||
ISN_CMDMOD, // set cmdmod
|
||||
ISN_CMDMOD_REV, // undo ISN_CMDMOD
|
||||
|
||||
ISN_PROF_START, // start a line for profiling
|
||||
ISN_PROF_END, // end a line for profiling
|
||||
|
||||
ISN_UNPACK, // unpack list into items, uses isn_arg.unpack
|
||||
ISN_SHUFFLE, // move item on stack up or down
|
||||
ISN_DROP // pop stack and discard value
|
||||
@@ -366,8 +369,14 @@ struct dfunc_S {
|
||||
// was compiled.
|
||||
|
||||
garray_T df_def_args_isn; // default argument instructions
|
||||
|
||||
// After compiling "df_instr" and/or "df_instr_prof" is not NULL.
|
||||
isn_T *df_instr; // function body to be executed
|
||||
int df_instr_count;
|
||||
int df_instr_count; // size of "df_instr"
|
||||
#ifdef FEAT_PROFILE
|
||||
isn_T *df_instr_prof; // like "df_instr" with profiling
|
||||
int df_instr_prof_count; // size of "df_instr_prof"
|
||||
#endif
|
||||
|
||||
int df_varcount; // number of local variables
|
||||
int df_has_closure; // one if a closure was created
|
||||
@@ -399,3 +408,13 @@ extern garray_T def_functions;
|
||||
|
||||
// Used for "lnum" when a range is to be taken from the stack and "!" is used.
|
||||
#define LNUM_VARIABLE_RANGE_ABOVE -888
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
# define PROFILING(ufunc) (do_profiling == PROF_YES && (ufunc)->uf_profiling)
|
||||
# define INSTRUCTIONS(dfunc) \
|
||||
((do_profiling == PROF_YES && (dfunc->df_ufunc)->uf_profiling) \
|
||||
? (dfunc)->df_instr_prof : (dfunc)->df_instr)
|
||||
#else
|
||||
# define PROFILING(ufunc) FALSE
|
||||
# define INSTRUCTIONS(dfunc) ((dfunc)->df_instr)
|
||||
#endif
|
||||
|
||||
@@ -44,6 +44,7 @@ struct endlabel_S {
|
||||
*/
|
||||
typedef struct {
|
||||
int is_seen_else;
|
||||
int is_seen_skip_not; // a block was unconditionally executed
|
||||
int is_had_return; // every block ends in :return
|
||||
int is_if_label; // instruction idx at IF or ELSEIF
|
||||
endlabel_T *is_end_label; // instructions to set end label
|
||||
@@ -123,6 +124,8 @@ struct cctx_S {
|
||||
char_u *ctx_line_start; // start of current line or NULL
|
||||
garray_T ctx_instr; // generated instructions
|
||||
|
||||
int ctx_profiling; // when TRUE generate ISN_PROF_START
|
||||
|
||||
garray_T ctx_locals; // currently visible local variables
|
||||
int ctx_locals_count; // total number of local variables
|
||||
|
||||
@@ -1692,6 +1695,34 @@ generate_BLOBAPPEND(cctx_T *cctx)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if "ufunc" should be compiled, taking into account whether
|
||||
* "profile" indicates profiling is to be done.
|
||||
*/
|
||||
int
|
||||
func_needs_compiling(ufunc_T *ufunc, int profile UNUSED)
|
||||
{
|
||||
switch (ufunc->uf_def_status)
|
||||
{
|
||||
case UF_NOT_COMPILED: break;
|
||||
case UF_TO_BE_COMPILED: return TRUE;
|
||||
case UF_COMPILED:
|
||||
{
|
||||
#ifdef FEAT_PROFILE
|
||||
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
|
||||
+ ufunc->uf_dfunc_idx;
|
||||
|
||||
return profile ? dfunc->df_instr_prof == NULL
|
||||
: dfunc->df_instr == NULL;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
case UF_COMPILING: break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate an ISN_DCALL or ISN_UCALL instruction.
|
||||
* Return FAIL if the number of arguments is wrong.
|
||||
@@ -1744,10 +1775,10 @@ generate_CALL(cctx_T *cctx, ufunc_T *ufunc, int pushed_argcount)
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
if (ufunc->uf_def_status == UF_TO_BE_COMPILED)
|
||||
if (compile_def_function(ufunc, ufunc->uf_ret_type == NULL, NULL)
|
||||
== FAIL)
|
||||
return FAIL;
|
||||
if (func_needs_compiling(ufunc, PROFILING(ufunc))
|
||||
&& compile_def_function(ufunc, ufunc->uf_ret_type == NULL,
|
||||
PROFILING(ufunc), NULL) == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
if ((isn = generate_instr(cctx,
|
||||
@@ -2063,6 +2094,15 @@ generate_undo_cmdmods(cctx_T *cctx)
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
static void
|
||||
may_generate_prof_end(cctx_T *cctx, int prof_lnum)
|
||||
{
|
||||
if (cctx->ctx_profiling && prof_lnum >= 0)
|
||||
generate_instr(cctx, ISN_PROF_END);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Reserve space for a local variable.
|
||||
* Return the variable or NULL if it failed.
|
||||
@@ -2575,9 +2615,10 @@ generate_funcref(cctx_T *cctx, char_u *name)
|
||||
return FAIL;
|
||||
|
||||
// Need to compile any default values to get the argument types.
|
||||
if (ufunc->uf_def_status == UF_TO_BE_COMPILED)
|
||||
if (compile_def_function(ufunc, TRUE, NULL) == FAIL)
|
||||
return FAIL;
|
||||
if (func_needs_compiling(ufunc, PROFILING(ufunc))
|
||||
&& compile_def_function(ufunc, TRUE, PROFILING(ufunc), NULL)
|
||||
== FAIL)
|
||||
return FAIL;
|
||||
return generate_PUSHFUNC(cctx, ufunc->uf_name, ufunc->uf_func_type);
|
||||
}
|
||||
|
||||
@@ -3070,7 +3111,7 @@ compile_lambda(char_u **arg, cctx_T *cctx)
|
||||
clear_tv(&rettv);
|
||||
|
||||
// Compile the function into instructions.
|
||||
compile_def_function(ufunc, TRUE, cctx);
|
||||
compile_def_function(ufunc, TRUE, PROFILING(ufunc), cctx);
|
||||
|
||||
clear_evalarg(&evalarg, NULL);
|
||||
|
||||
@@ -5047,8 +5088,9 @@ compile_nested_function(exarg_T *eap, cctx_T *cctx)
|
||||
r = eap->skip ? OK : FAIL;
|
||||
goto theend;
|
||||
}
|
||||
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
|
||||
&& compile_def_function(ufunc, TRUE, cctx) == FAIL)
|
||||
if (func_needs_compiling(ufunc, PROFILING(ufunc))
|
||||
&& compile_def_function(ufunc, TRUE, PROFILING(ufunc), cctx)
|
||||
== FAIL)
|
||||
{
|
||||
func_ptr_unref(ufunc);
|
||||
goto theend;
|
||||
@@ -6524,7 +6566,7 @@ compile_jump_to_end(endlabel_T **el, jumpwhen_T when, cctx_T *cctx)
|
||||
}
|
||||
|
||||
static void
|
||||
compile_fill_jump_to_end(endlabel_T **el, cctx_T *cctx)
|
||||
compile_fill_jump_to_end(endlabel_T **el, int jump_where, cctx_T *cctx)
|
||||
{
|
||||
garray_T *instr = &cctx->ctx_instr;
|
||||
|
||||
@@ -6534,7 +6576,7 @@ compile_fill_jump_to_end(endlabel_T **el, cctx_T *cctx)
|
||||
isn_T *isn;
|
||||
|
||||
isn = ((isn_T *)instr->ga_data) + cur->el_end_label;
|
||||
isn->isn_arg.jump.jump_where = instr->ga_len;
|
||||
isn->isn_arg.jump.jump_where = jump_where;
|
||||
*el = cur->el_next;
|
||||
vim_free(cur);
|
||||
}
|
||||
@@ -6688,6 +6730,18 @@ compile_if(char_u *arg, cctx_T *cctx)
|
||||
else
|
||||
scope->se_u.se_if.is_if_label = -1;
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx->ctx_profiling && cctx->ctx_skip == SKIP_YES
|
||||
&& skip_save != SKIP_YES)
|
||||
{
|
||||
// generated a profile start, need to generate a profile end, since it
|
||||
// won't be done after returning
|
||||
cctx->ctx_skip = SKIP_NOT;
|
||||
generate_instr(cctx, ISN_PROF_END);
|
||||
cctx->ctx_skip = SKIP_YES;
|
||||
}
|
||||
#endif
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -6711,6 +6765,25 @@ compile_elseif(char_u *arg, cctx_T *cctx)
|
||||
if (!cctx->ctx_had_return)
|
||||
scope->se_u.se_if.is_had_return = FALSE;
|
||||
|
||||
if (cctx->ctx_skip == SKIP_NOT)
|
||||
{
|
||||
// previous block was executed, this one and following will not
|
||||
cctx->ctx_skip = SKIP_YES;
|
||||
scope->se_u.se_if.is_seen_skip_not = TRUE;
|
||||
}
|
||||
if (scope->se_u.se_if.is_seen_skip_not)
|
||||
{
|
||||
// A previous block was executed, skip over expression and bail out.
|
||||
// Do not count the "elseif" for profiling.
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||
.isn_type == ISN_PROF_START)
|
||||
--instr->ga_len;
|
||||
#endif
|
||||
skip_expr_cctx(&p, cctx);
|
||||
return p;
|
||||
}
|
||||
|
||||
if (cctx->ctx_skip == SKIP_UNKNOWN)
|
||||
{
|
||||
if (compile_jump_to_end(&scope->se_u.se_if.is_end_label,
|
||||
@@ -6724,7 +6797,17 @@ compile_elseif(char_u *arg, cctx_T *cctx)
|
||||
// compile "expr"; if we know it evaluates to FALSE skip the block
|
||||
CLEAR_FIELD(ppconst);
|
||||
if (cctx->ctx_skip == SKIP_YES)
|
||||
{
|
||||
cctx->ctx_skip = SKIP_UNKNOWN;
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx->ctx_profiling)
|
||||
{
|
||||
// the previous block was skipped, need to profile this line
|
||||
generate_instr(cctx, ISN_PROF_START);
|
||||
instr_count = instr->ga_len;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (compile_expr1(&p, cctx, &ppconst) == FAIL)
|
||||
{
|
||||
clear_ppconst(&ppconst);
|
||||
@@ -6782,7 +6865,27 @@ compile_else(char_u *arg, cctx_T *cctx)
|
||||
scope->se_u.se_if.is_had_return = FALSE;
|
||||
scope->se_u.se_if.is_seen_else = TRUE;
|
||||
|
||||
if (scope->se_skip_save != SKIP_YES)
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx->ctx_profiling)
|
||||
{
|
||||
if (cctx->ctx_skip == SKIP_NOT
|
||||
&& ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||
.isn_type == ISN_PROF_START)
|
||||
// the previous block was executed, do not count "else" for profiling
|
||||
--instr->ga_len;
|
||||
if (cctx->ctx_skip == SKIP_YES && !scope->se_u.se_if.is_seen_skip_not)
|
||||
{
|
||||
// the previous block was not executed, this one will, do count the
|
||||
// "else" for profiling
|
||||
cctx->ctx_skip = SKIP_NOT;
|
||||
generate_instr(cctx, ISN_PROF_END);
|
||||
generate_instr(cctx, ISN_PROF_START);
|
||||
cctx->ctx_skip = SKIP_YES;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!scope->se_u.se_if.is_seen_skip_not && scope->se_skip_save != SKIP_YES)
|
||||
{
|
||||
// jump from previous block to the end, unless the else block is empty
|
||||
if (cctx->ctx_skip == SKIP_UNKNOWN)
|
||||
@@ -6836,7 +6939,18 @@ compile_endif(char_u *arg, cctx_T *cctx)
|
||||
isn->isn_arg.jump.jump_where = instr->ga_len;
|
||||
}
|
||||
// Fill in the "end" label in jumps at the end of the blocks.
|
||||
compile_fill_jump_to_end(&ifscope->is_end_label, cctx);
|
||||
compile_fill_jump_to_end(&ifscope->is_end_label, instr->ga_len, cctx);
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
// even when skipping we count the endif as executed, unless the block it's
|
||||
// in is skipped
|
||||
if (cctx->ctx_profiling && cctx->ctx_skip == SKIP_YES
|
||||
&& scope->se_skip_save != SKIP_YES)
|
||||
{
|
||||
cctx->ctx_skip = SKIP_NOT;
|
||||
generate_instr(cctx, ISN_PROF_START);
|
||||
}
|
||||
#endif
|
||||
cctx->ctx_skip = scope->se_skip_save;
|
||||
|
||||
// If all the blocks end in :return and there is an :else then the
|
||||
@@ -7068,7 +7182,7 @@ compile_endfor(char_u *arg, cctx_T *cctx)
|
||||
isn->isn_arg.forloop.for_end = instr->ga_len;
|
||||
|
||||
// Fill in the "end" label any BREAK statements
|
||||
compile_fill_jump_to_end(&forscope->fs_end_label, cctx);
|
||||
compile_fill_jump_to_end(&forscope->fs_end_label, instr->ga_len, cctx);
|
||||
|
||||
// Below the ":for" scope drop the "expr" list from the stack.
|
||||
if (generate_instr_drop(cctx, ISN_DROP, 1) == NULL)
|
||||
@@ -7101,7 +7215,13 @@ compile_while(char_u *arg, cctx_T *cctx)
|
||||
if (scope == NULL)
|
||||
return NULL;
|
||||
|
||||
// "endwhile" jumps back here, one before when profiling
|
||||
scope->se_u.se_while.ws_top_label = instr->ga_len;
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||
.isn_type == ISN_PROF_START)
|
||||
--scope->se_u.se_while.ws_top_label;
|
||||
#endif
|
||||
|
||||
// compile "expr"
|
||||
if (compile_expr0(&p, cctx) == FAIL)
|
||||
@@ -7125,6 +7245,7 @@ compile_while(char_u *arg, cctx_T *cctx)
|
||||
compile_endwhile(char_u *arg, cctx_T *cctx)
|
||||
{
|
||||
scope_T *scope = cctx->ctx_scope;
|
||||
garray_T *instr = &cctx->ctx_instr;
|
||||
|
||||
if (scope == NULL || scope->se_type != WHILE_SCOPE)
|
||||
{
|
||||
@@ -7134,12 +7255,18 @@ compile_endwhile(char_u *arg, cctx_T *cctx)
|
||||
cctx->ctx_scope = scope->se_outer;
|
||||
unwind_locals(cctx, scope->se_local_count);
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
// count the endwhile before jumping
|
||||
may_generate_prof_end(cctx, cctx->ctx_lnum);
|
||||
#endif
|
||||
|
||||
// At end of ":for" scope jump back to the FOR instruction.
|
||||
generate_JUMP(cctx, JUMP_ALWAYS, scope->se_u.se_while.ws_top_label);
|
||||
|
||||
// Fill in the "end" label in the WHILE statement so it can jump here.
|
||||
// And in any jumps for ":break"
|
||||
compile_fill_jump_to_end(&scope->se_u.se_while.ws_end_label, cctx);
|
||||
compile_fill_jump_to_end(&scope->se_u.se_while.ws_end_label,
|
||||
instr->ga_len, cctx);
|
||||
|
||||
vim_free(scope);
|
||||
|
||||
@@ -7321,6 +7448,12 @@ compile_catch(char_u *arg, cctx_T *cctx UNUSED)
|
||||
|
||||
if (cctx->ctx_skip != SKIP_YES)
|
||||
{
|
||||
#ifdef FEAT_PROFILE
|
||||
// the profile-start should be after the jump
|
||||
if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||
.isn_type == ISN_PROF_START)
|
||||
--instr->ga_len;
|
||||
#endif
|
||||
// Jump from end of previous block to :finally or :endtry
|
||||
if (compile_jump_to_end(&scope->se_u.se_try.ts_end_label,
|
||||
JUMP_ALWAYS, cctx) == FAIL)
|
||||
@@ -7336,6 +7469,15 @@ compile_catch(char_u *arg, cctx_T *cctx UNUSED)
|
||||
isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_catch_label;
|
||||
isn->isn_arg.jump.jump_where = instr->ga_len;
|
||||
}
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx->ctx_profiling)
|
||||
{
|
||||
// a "throw" that jumps here needs to be counted
|
||||
generate_instr(cctx, ISN_PROF_END);
|
||||
// the "catch" is also counted
|
||||
generate_instr(cctx, ISN_PROF_START);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
p = skipwhite(arg);
|
||||
@@ -7396,6 +7538,7 @@ compile_finally(char_u *arg, cctx_T *cctx)
|
||||
scope_T *scope = cctx->ctx_scope;
|
||||
garray_T *instr = &cctx->ctx_instr;
|
||||
isn_T *isn;
|
||||
int this_instr;
|
||||
|
||||
// end block scope from :try or :catch
|
||||
if (scope != NULL && scope->se_type == BLOCK_SCOPE)
|
||||
@@ -7417,15 +7560,24 @@ compile_finally(char_u *arg, cctx_T *cctx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Fill in the "end" label in jumps at the end of the blocks.
|
||||
compile_fill_jump_to_end(&scope->se_u.se_try.ts_end_label, cctx);
|
||||
this_instr = instr->ga_len;
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||
.isn_type == ISN_PROF_START)
|
||||
// jump to the profile start of the "finally"
|
||||
--this_instr;
|
||||
#endif
|
||||
|
||||
isn->isn_arg.try.try_finally = instr->ga_len;
|
||||
// Fill in the "end" label in jumps at the end of the blocks.
|
||||
compile_fill_jump_to_end(&scope->se_u.se_try.ts_end_label,
|
||||
this_instr, cctx);
|
||||
|
||||
isn->isn_arg.try.try_finally = this_instr;
|
||||
if (scope->se_u.se_try.ts_catch_label != 0)
|
||||
{
|
||||
// Previous catch without match jumps here
|
||||
isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_catch_label;
|
||||
isn->isn_arg.jump.jump_where = instr->ga_len;
|
||||
isn->isn_arg.jump.jump_where = this_instr;
|
||||
scope->se_u.se_try.ts_catch_label = 0;
|
||||
}
|
||||
|
||||
@@ -7470,9 +7622,18 @@ compile_endtry(char_u *arg, cctx_T *cctx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx->ctx_profiling && ((isn_T *)instr->ga_data)[instr->ga_len - 1]
|
||||
.isn_type == ISN_PROF_START)
|
||||
// move the profile start after "endtry" so that it's not counted when
|
||||
// the exception is rethrown.
|
||||
--instr->ga_len;
|
||||
#endif
|
||||
|
||||
// Fill in the "end" label in jumps at the end of the blocks, if not
|
||||
// done by ":finally".
|
||||
compile_fill_jump_to_end(&scope->se_u.se_try.ts_end_label, cctx);
|
||||
compile_fill_jump_to_end(&scope->se_u.se_try.ts_end_label,
|
||||
instr->ga_len, cctx);
|
||||
|
||||
// End :catch or :finally scope: set value in ISN_TRY instruction
|
||||
if (isn->isn_arg.try.try_catch == 0)
|
||||
@@ -7492,6 +7653,10 @@ compile_endtry(char_u *arg, cctx_T *cctx)
|
||||
|
||||
if (cctx->ctx_skip != SKIP_YES && generate_instr(cctx, ISN_ENDTRY) == NULL)
|
||||
return NULL;
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx->ctx_profiling)
|
||||
generate_instr(cctx, ISN_PROF_START);
|
||||
#endif
|
||||
return arg;
|
||||
}
|
||||
|
||||
@@ -7794,13 +7959,18 @@ add_def_function(ufunc_T *ufunc)
|
||||
* When "check_return_type" is set then set ufunc->uf_ret_type to the type of
|
||||
* the return statement (used for lambda). When uf_ret_type is already set
|
||||
* then check that it matches.
|
||||
* When "profiling" is true add ISN_PROF_START instructions.
|
||||
* "outer_cctx" is set for a nested function.
|
||||
* This can be used recursively through compile_lambda(), which may reallocate
|
||||
* "def_functions".
|
||||
* Returns OK or FAIL.
|
||||
*/
|
||||
int
|
||||
compile_def_function(ufunc_T *ufunc, int check_return_type, cctx_T *outer_cctx)
|
||||
compile_def_function(
|
||||
ufunc_T *ufunc,
|
||||
int check_return_type,
|
||||
int profiling UNUSED,
|
||||
cctx_T *outer_cctx)
|
||||
{
|
||||
char_u *line = NULL;
|
||||
char_u *p;
|
||||
@@ -7813,6 +7983,9 @@ compile_def_function(ufunc_T *ufunc, int check_return_type, cctx_T *outer_cctx)
|
||||
int save_estack_compiling = estack_compiling;
|
||||
int do_estack_push;
|
||||
int new_def_function = FALSE;
|
||||
#ifdef FEAT_PROFILE
|
||||
int prof_lnum = -1;
|
||||
#endif
|
||||
|
||||
// When using a function that was compiled before: Free old instructions.
|
||||
// The index is reused. Otherwise add a new entry in "def_functions".
|
||||
@@ -7832,6 +8005,10 @@ compile_def_function(ufunc_T *ufunc, int check_return_type, cctx_T *outer_cctx)
|
||||
ufunc->uf_def_status = UF_COMPILING;
|
||||
|
||||
CLEAR_FIELD(cctx);
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
cctx.ctx_profiling = profiling;
|
||||
#endif
|
||||
cctx.ctx_ufunc = ufunc;
|
||||
cctx.ctx_lnum = -1;
|
||||
cctx.ctx_outer = outer_cctx;
|
||||
@@ -7932,22 +8109,41 @@ compile_def_function(ufunc_T *ufunc, int check_return_type, cctx_T *outer_cctx)
|
||||
{
|
||||
line = next_line_from_context(&cctx, FALSE);
|
||||
if (cctx.ctx_lnum >= ufunc->uf_lines.ga_len)
|
||||
{
|
||||
// beyond the last line
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx.ctx_skip != SKIP_YES)
|
||||
may_generate_prof_end(&cctx, prof_lnum);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CLEAR_FIELD(ea);
|
||||
ea.cmdlinep = &line;
|
||||
ea.cmd = skipwhite(line);
|
||||
|
||||
if (*ea.cmd == '#')
|
||||
{
|
||||
// "#" starts a comment
|
||||
line = (char_u *)"";
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx.ctx_profiling && cctx.ctx_lnum != prof_lnum &&
|
||||
cctx.ctx_skip != SKIP_YES)
|
||||
{
|
||||
may_generate_prof_end(&cctx, prof_lnum);
|
||||
|
||||
prof_lnum = cctx.ctx_lnum;
|
||||
generate_instr(&cctx, ISN_PROF_START);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Some things can be recognized by the first character.
|
||||
switch (*ea.cmd)
|
||||
{
|
||||
case '#':
|
||||
// "#" starts a comment
|
||||
line = (char_u *)"";
|
||||
continue;
|
||||
|
||||
case '}':
|
||||
{
|
||||
// "}" ends a block scope
|
||||
@@ -8308,8 +8504,18 @@ nextline:
|
||||
+ ufunc->uf_dfunc_idx;
|
||||
dfunc->df_deleted = FALSE;
|
||||
dfunc->df_script_seq = current_sctx.sc_seq;
|
||||
dfunc->df_instr = instr->ga_data;
|
||||
dfunc->df_instr_count = instr->ga_len;
|
||||
#ifdef FEAT_PROFILE
|
||||
if (cctx.ctx_profiling)
|
||||
{
|
||||
dfunc->df_instr_prof = instr->ga_data;
|
||||
dfunc->df_instr_prof_count = instr->ga_len;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
dfunc->df_instr = instr->ga_data;
|
||||
dfunc->df_instr_count = instr->ga_len;
|
||||
}
|
||||
dfunc->df_varcount = cctx.ctx_locals_count;
|
||||
dfunc->df_has_closure = cctx.ctx_has_closure;
|
||||
if (cctx.ctx_outer_used)
|
||||
@@ -8586,6 +8792,8 @@ delete_instr(isn_T *isn)
|
||||
case ISN_OPNR:
|
||||
case ISN_PCALL:
|
||||
case ISN_PCALL_END:
|
||||
case ISN_PROF_END:
|
||||
case ISN_PROF_START:
|
||||
case ISN_PUSHBOOL:
|
||||
case ISN_PUSHF:
|
||||
case ISN_PUSHNR:
|
||||
@@ -8629,6 +8837,15 @@ delete_def_function_contents(dfunc_T *dfunc, int mark_deleted)
|
||||
VIM_CLEAR(dfunc->df_instr);
|
||||
dfunc->df_instr = NULL;
|
||||
}
|
||||
#ifdef FEAT_PROFILE
|
||||
if (dfunc->df_instr_prof != NULL)
|
||||
{
|
||||
for (idx = 0; idx < dfunc->df_instr_prof_count; ++idx)
|
||||
delete_instr(dfunc->df_instr_prof + idx);
|
||||
VIM_CLEAR(dfunc->df_instr_prof);
|
||||
dfunc->df_instr_prof = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mark_deleted)
|
||||
dfunc->df_deleted = TRUE;
|
||||
|
||||
@@ -181,6 +181,16 @@ call_dfunc(int cdf_idx, partial_T *pt, int argcount_arg, ectx_T *ectx)
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
// Profiling might be enabled/disabled along the way. This should not
|
||||
// fail, since the function was compiled before and toggling profiling
|
||||
// doesn't change any errors.
|
||||
if (func_needs_compiling(ufunc, PROFILING(ufunc))
|
||||
&& compile_def_function(ufunc, FALSE, PROFILING(ufunc), NULL)
|
||||
== FAIL)
|
||||
return FAIL;
|
||||
#endif
|
||||
|
||||
if (ufunc->uf_va_name != NULL)
|
||||
{
|
||||
// Need to make a list out of the vararg arguments.
|
||||
@@ -293,8 +303,8 @@ call_dfunc(int cdf_idx, partial_T *pt, int argcount_arg, ectx_T *ectx)
|
||||
|
||||
// Set execution state to the start of the called function.
|
||||
ectx->ec_dfunc_idx = cdf_idx;
|
||||
ectx->ec_instr = dfunc->df_instr;
|
||||
entry = estack_push_ufunc(dfunc->df_ufunc, 1);
|
||||
ectx->ec_instr = INSTRUCTIONS(dfunc);
|
||||
entry = estack_push_ufunc(ufunc, 1);
|
||||
if (entry != NULL)
|
||||
{
|
||||
// Set the script context to the script where the function was defined.
|
||||
@@ -542,7 +552,7 @@ func_return(ectx_T *ectx)
|
||||
ectx->ec_frame_idx = STACK_TV(ectx->ec_frame_idx
|
||||
+ STACK_FRAME_IDX_OFF)->vval.v_number;
|
||||
dfunc = ((dfunc_T *)def_functions.ga_data) + ectx->ec_dfunc_idx;
|
||||
ectx->ec_instr = dfunc->df_instr;
|
||||
ectx->ec_instr = INSTRUCTIONS(dfunc);
|
||||
|
||||
if (ret_idx > 0)
|
||||
{
|
||||
@@ -645,9 +655,14 @@ call_ufunc(
|
||||
int error;
|
||||
int idx;
|
||||
int did_emsg_before = did_emsg;
|
||||
#ifdef FEAT_PROFILE
|
||||
int profiling = do_profiling == PROF_YES && ufunc->uf_profiling;
|
||||
#else
|
||||
# define profiling FALSE
|
||||
#endif
|
||||
|
||||
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
|
||||
&& compile_def_function(ufunc, FALSE, NULL) == FAIL)
|
||||
if (func_needs_compiling(ufunc, profiling)
|
||||
&& compile_def_function(ufunc, FALSE, profiling, NULL) == FAIL)
|
||||
return FAIL;
|
||||
if (ufunc->uf_def_status == UF_COMPILED)
|
||||
{
|
||||
@@ -1098,6 +1113,7 @@ fill_partial_and_closure(partial_T *pt, ufunc_T *ufunc, ectx_T *ectx)
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Call a "def" function from old Vim script.
|
||||
* Return OK or FAIL.
|
||||
@@ -1142,8 +1158,9 @@ call_def_function(
|
||||
#define STACK_TV_VAR(idx) (((typval_T *)ectx.ec_stack.ga_data) + ectx.ec_frame_idx + STACK_FRAME_SIZE + idx)
|
||||
|
||||
if (ufunc->uf_def_status == UF_NOT_COMPILED
|
||||
|| (ufunc->uf_def_status == UF_TO_BE_COMPILED
|
||||
&& compile_def_function(ufunc, FALSE, NULL) == FAIL))
|
||||
|| (func_needs_compiling(ufunc, PROFILING(ufunc))
|
||||
&& compile_def_function(ufunc, FALSE, PROFILING(ufunc), NULL)
|
||||
== FAIL))
|
||||
{
|
||||
if (did_emsg_cumul + did_emsg == did_emsg_before)
|
||||
semsg(_(e_function_is_not_compiled_str),
|
||||
@@ -1155,7 +1172,7 @@ call_def_function(
|
||||
// Check the function was really compiled.
|
||||
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
|
||||
+ ufunc->uf_dfunc_idx;
|
||||
if (dfunc->df_instr == NULL)
|
||||
if (INSTRUCTIONS(dfunc) == NULL)
|
||||
{
|
||||
iemsg("using call_def_function() on not compiled function");
|
||||
return FAIL;
|
||||
@@ -1294,7 +1311,7 @@ call_def_function(
|
||||
++ectx.ec_stack.ga_len;
|
||||
}
|
||||
|
||||
ectx.ec_instr = dfunc->df_instr;
|
||||
ectx.ec_instr = INSTRUCTIONS(dfunc);
|
||||
}
|
||||
|
||||
// Following errors are in the function, not the caller.
|
||||
@@ -2594,7 +2611,7 @@ call_def_function(
|
||||
|
||||
if (trystack->ga_len > 0)
|
||||
{
|
||||
trycmd_T *trycmd = NULL;
|
||||
trycmd_T *trycmd;
|
||||
|
||||
--trystack->ga_len;
|
||||
--trylevel;
|
||||
@@ -2616,34 +2633,54 @@ call_def_function(
|
||||
break;
|
||||
|
||||
case ISN_THROW:
|
||||
if (ectx.ec_trystack.ga_len == 0 && trylevel == 0
|
||||
&& emsg_silent)
|
||||
{
|
||||
// throwing an exception while using "silent!" causes the
|
||||
// function to abort but not display an error.
|
||||
tv = STACK_TV_BOT(-1);
|
||||
clear_tv(tv);
|
||||
tv->v_type = VAR_NUMBER;
|
||||
tv->vval.v_number = 0;
|
||||
goto done;
|
||||
}
|
||||
--ectx.ec_stack.ga_len;
|
||||
tv = STACK_TV_BOT(0);
|
||||
if (tv->vval.v_string == NULL
|
||||
|| *skipwhite(tv->vval.v_string) == NUL)
|
||||
{
|
||||
vim_free(tv->vval.v_string);
|
||||
SOURCING_LNUM = iptr->isn_lnum;
|
||||
emsg(_(e_throw_with_empty_string));
|
||||
goto failed;
|
||||
}
|
||||
garray_T *trystack = &ectx.ec_trystack;
|
||||
|
||||
if (throw_exception(tv->vval.v_string, ET_USER, NULL) == FAIL)
|
||||
{
|
||||
vim_free(tv->vval.v_string);
|
||||
goto failed;
|
||||
if (trystack->ga_len == 0 && trylevel == 0 && emsg_silent)
|
||||
{
|
||||
// throwing an exception while using "silent!" causes
|
||||
// the function to abort but not display an error.
|
||||
tv = STACK_TV_BOT(-1);
|
||||
clear_tv(tv);
|
||||
tv->v_type = VAR_NUMBER;
|
||||
tv->vval.v_number = 0;
|
||||
goto done;
|
||||
}
|
||||
--ectx.ec_stack.ga_len;
|
||||
tv = STACK_TV_BOT(0);
|
||||
if (tv->vval.v_string == NULL
|
||||
|| *skipwhite(tv->vval.v_string) == NUL)
|
||||
{
|
||||
vim_free(tv->vval.v_string);
|
||||
SOURCING_LNUM = iptr->isn_lnum;
|
||||
emsg(_(e_throw_with_empty_string));
|
||||
goto failed;
|
||||
}
|
||||
|
||||
// Inside a "catch" we need to first discard the caught
|
||||
// exception.
|
||||
if (trystack->ga_len > 0)
|
||||
{
|
||||
trycmd_T *trycmd = ((trycmd_T *)trystack->ga_data)
|
||||
+ trystack->ga_len - 1;
|
||||
if (trycmd->tcd_caught && current_exception != NULL)
|
||||
{
|
||||
// discard the exception
|
||||
if (caught_stack == current_exception)
|
||||
caught_stack = caught_stack->caught;
|
||||
discard_current_exception();
|
||||
trycmd->tcd_caught = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (throw_exception(tv->vval.v_string, ET_USER, NULL)
|
||||
== FAIL)
|
||||
{
|
||||
vim_free(tv->vval.v_string);
|
||||
goto failed;
|
||||
}
|
||||
did_throw = TRUE;
|
||||
}
|
||||
did_throw = TRUE;
|
||||
break;
|
||||
|
||||
// compare with special values
|
||||
@@ -3495,6 +3532,28 @@ call_def_function(
|
||||
}
|
||||
break;
|
||||
|
||||
case ISN_PROF_START:
|
||||
case ISN_PROF_END:
|
||||
{
|
||||
#ifdef FEAT_PROFILE
|
||||
funccall_T cookie;
|
||||
ufunc_T *cur_ufunc =
|
||||
(((dfunc_T *)def_functions.ga_data)
|
||||
+ ectx.ec_dfunc_idx)->df_ufunc;
|
||||
|
||||
cookie.func = cur_ufunc;
|
||||
if (iptr->isn_type == ISN_PROF_START)
|
||||
{
|
||||
func_line_start(&cookie, iptr->isn_lnum);
|
||||
// if we get here the instruction is executed
|
||||
func_line_exec(&cookie);
|
||||
}
|
||||
else
|
||||
func_line_end(&cookie);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case ISN_SHUFFLE:
|
||||
{
|
||||
typval_T tmp_tv;
|
||||
@@ -3642,6 +3701,7 @@ ex_disassemble(exarg_T *eap)
|
||||
ufunc_T *ufunc;
|
||||
dfunc_T *dfunc;
|
||||
isn_T *instr;
|
||||
int instr_count;
|
||||
int current;
|
||||
int line_idx = 0;
|
||||
int prev_current = 0;
|
||||
@@ -3677,8 +3737,8 @@ ex_disassemble(exarg_T *eap)
|
||||
semsg(_(e_cannot_find_function_str), eap->arg);
|
||||
return;
|
||||
}
|
||||
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
|
||||
&& compile_def_function(ufunc, FALSE, NULL) == FAIL)
|
||||
if (func_needs_compiling(ufunc, eap->forceit)
|
||||
&& compile_def_function(ufunc, FALSE, eap->forceit, NULL) == FAIL)
|
||||
return;
|
||||
if (ufunc->uf_def_status != UF_COMPILED)
|
||||
{
|
||||
@@ -3691,8 +3751,15 @@ ex_disassemble(exarg_T *eap)
|
||||
msg((char *)ufunc->uf_name);
|
||||
|
||||
dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx;
|
||||
#ifdef FEAT_PROFILE
|
||||
instr = eap->forceit ? dfunc->df_instr_prof : dfunc->df_instr;
|
||||
instr_count = eap->forceit ? dfunc->df_instr_prof_count
|
||||
: dfunc->df_instr_count;
|
||||
#else
|
||||
instr = dfunc->df_instr;
|
||||
for (current = 0; current < dfunc->df_instr_count; ++current)
|
||||
instr_count = dfunc->df_instr_count;
|
||||
#endif
|
||||
for (current = 0; current < instr_count; ++current)
|
||||
{
|
||||
isn_T *iptr = &instr[current];
|
||||
char *line;
|
||||
@@ -4319,6 +4386,14 @@ ex_disassemble(exarg_T *eap)
|
||||
}
|
||||
case ISN_CMDMOD_REV: smsg("%4d CMDMOD_REV", current); break;
|
||||
|
||||
case ISN_PROF_START:
|
||||
smsg("%4d PROFILE START line %d", current, iptr->isn_lnum);
|
||||
break;
|
||||
|
||||
case ISN_PROF_END:
|
||||
smsg("%4d PROFILE END", current);
|
||||
break;
|
||||
|
||||
case ISN_UNPACK: smsg("%4d UNPACK %d%s", current,
|
||||
iptr->isn_arg.unpack.unp_count,
|
||||
iptr->isn_arg.unpack.unp_semicolon ? " semicolon" : "");
|
||||
|
||||
@@ -336,7 +336,8 @@ typval2type_int(typval_T *tv, garray_T *type_gap)
|
||||
// May need to get the argument types from default values by
|
||||
// compiling the function.
|
||||
if (ufunc->uf_def_status == UF_TO_BE_COMPILED
|
||||
&& compile_def_function(ufunc, TRUE, NULL) == FAIL)
|
||||
&& compile_def_function(ufunc, TRUE, FALSE, NULL)
|
||||
== FAIL)
|
||||
return NULL;
|
||||
if (ufunc->uf_func_type == NULL)
|
||||
set_function_type(ufunc);
|
||||
|
||||
Reference in New Issue
Block a user