Merge remote-tracking branch 'vim/master'

This commit is contained in:
ichizok
2021-04-09 16:59:25 +09:00
55 changed files with 872 additions and 141 deletions
+7
View File
@@ -42,6 +42,7 @@ runtime/compiler/jshint.vim @dkearns
runtime/compiler/jsonlint.vim @dkearns
runtime/compiler/lazbuild.vim @dkearns
runtime/compiler/php.vim @dkearns
runtime/compiler/powershell.vim @heaths
runtime/compiler/rake.vim @tpope @dkearns
runtime/compiler/rhino.vim @dkearns
runtime/compiler/rspec.vim @tpope @dkearns
@@ -67,6 +68,7 @@ runtime/doc/pi_netrw.txt @cecamp
runtime/doc/pi_tar.txt @cecamp
runtime/doc/pi_vimball.txt @cecamp
runtime/doc/pi_zip.txt @cecamp
runtime/doc/ps1.txt @heaths
runtime/ftplugin/awk.vim @dkearns
runtime/ftplugin/basic.vim @dkearns
runtime/ftplugin/bst.vim @tpope
@@ -93,6 +95,8 @@ runtime/ftplugin/matlab.vim @cecamp
runtime/ftplugin/nroff.vim @a-vrma
runtime/ftplugin/nsis.vim @k-takata
runtime/ftplugin/pdf.vim @tpope
runtime/ftplugin/ps1.vim @heaths
runtime/ftplugin/ps1xml.vim @heaths
runtime/ftplugin/ruby.vim @tpope @dkearns
runtime/ftplugin/sass.vim @tpope
runtime/ftplugin/scss.vim @tpope
@@ -111,6 +115,7 @@ runtime/indent/gitconfig.vim @tpope
runtime/indent/haml.vim @tpope
runtime/indent/liquid.vim @tpope
runtime/indent/nsis.vim @k-takata
runtime/indent/ps1.vim @heaths
runtime/indent/ruby.vim @AndrewRadev @dkearns
runtime/indent/sass.vim @tpope
runtime/indent/scss.vim @tpope
@@ -173,6 +178,8 @@ runtime/syntax/pdf.vim @tpope
runtime/syntax/php.vim @TysonAndre
runtime/syntax/privoxy.vim @dkearns
runtime/syntax/prolog.vim @XVilka
runtime/syntax/ps1.vim @heaths
runtime/syntax/ps1xml.vim @heaths
runtime/syntax/rc.vim @chrisbra
runtime/syntax/rpcgen.vim @cecamp
runtime/syntax/ruby.vim @dkearns
+1 -1
View File
@@ -6,7 +6,7 @@ if 1
echo "*** Interface versions ***\n"
echo 'Lua:'
PrintVer lua print(_VERSION)
PrintVer lua print(vim.lua_version, jit and "(LuaJIT)" or "")
echo 'MzScheme:'
PrintVer mzscheme (display (version))
+84
View File
@@ -0,0 +1,84 @@
" Vim compiler file
" Compiler: powershell
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2020 Mar 30
if exists("current_compiler")
finish
endif
let current_compiler = "powershell"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
if !exists("g:ps1_makeprg_cmd")
if executable('pwsh')
" pwsh is the future
let g:ps1_makeprg_cmd = 'pwsh'
elseif executable('pwsh.exe')
let g:ps1_makeprg_cmd = 'pwsh.exe'
elseif executable('powershell.exe')
let g:ps1_makeprg_cmd = 'powershell.exe'
else
let g:ps1_makeprg_cmd = ''
endif
endif
if !executable(g:ps1_makeprg_cmd)
echoerr "To use the powershell compiler, please set g:ps1_makeprg_cmd to the powershell executable!"
endif
" Show CategoryInfo, FullyQualifiedErrorId, etc?
let g:ps1_efm_show_error_categories = get(g:, 'ps1_efm_show_error_categories', 0)
" Use absolute path because powershell requires explicit relative paths
" (./file.ps1 is okay, but # expands to file.ps1)
let &l:makeprg = g:ps1_makeprg_cmd .' %:p:S'
" Parse file, line, char from callstacks:
" Write-Ouput : The term 'Write-Ouput' is not recognized as the name of a
" cmdlet, function, script file, or operable program. Check the spelling
" of the name, or if a path was included, verify that the path is correct
" and try again.
" At C:\script.ps1:11 char:5
" + Write-Ouput $content
" + ~~~~~~~~~~~
" + CategoryInfo : ObjectNotFound: (Write-Ouput:String) [], CommandNotFoundException
" + FullyQualifiedErrorId : CommandNotFoundException
" Showing error in context with underlining.
CompilerSet errorformat=%+G+%m
" Error summary.
CompilerSet errorformat+=%E%*\\S\ :\ %m
" Error location.
CompilerSet errorformat+=%CAt\ %f:%l\ char:%c
" Errors that span multiple lines (may be wrapped to width of terminal).
CompilerSet errorformat+=%C%m
" Ignore blank/whitespace-only lines.
CompilerSet errorformat+=%Z\\s%#
if g:ps1_efm_show_error_categories
CompilerSet errorformat^=%+G\ \ \ \ +\ %.%#\\s%#:\ %m
else
CompilerSet errorformat^=%-G\ \ \ \ +\ %.%#\\s%#:\ %m
endif
" Parse file, line, char from of parse errors:
" At C:\script.ps1:22 char:16
" + Stop-Process -Name "invalidprocess
" + ~~~~~~~~~~~~~~~
" The string is missing the terminator: ".
" + CategoryInfo : ParserError: (:) [], ParseException
" + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
CompilerSet errorformat+=At\ %f:%l\ char:%c
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set sw=2 sts=2:
+2
View File
@@ -30,6 +30,7 @@ DOCS = \
filetype.txt \
fold.txt \
ft_ada.txt \
ft_ps1.txt \
ft_rust.txt \
ft_sql.txt \
gui.txt \
@@ -174,6 +175,7 @@ HTMLS = \
filetype.html \
fold.html \
ft_ada.html \
ft_ps1.html \
ft_rust.html \
ft_sql.html \
gui.html \
+3 -1
View File
@@ -1,4 +1,4 @@
*cmdline.txt* For Vim version 8.2. Last change: 2021 Jan 26
*cmdline.txt* For Vim version 8.2. Last change: 2021 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -597,9 +597,11 @@ followed by another Vim command:
:global
:help
:helpfind
:helpgrep
:lcscope
:ldo
:lfdo
:lhelpgrep
:make
:normal
:perl
+2 -2
View File
@@ -1,4 +1,4 @@
*editing.txt* For Vim version 8.2. Last change: 2021 Jan 08
*editing.txt* For Vim version 8.2. Last change: 2021 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1253,7 +1253,7 @@ For versions of Vim where browsing is not supported, the command is executed
unmodified.
*browsefilter*
For MS Windows and GTK, you can modify the filters that are used in the browse
For MS-Windows and GTK, you can modify the filters that are used in the browse
dialog. By setting the g:browsefilter or b:browsefilter variables, you can
change the filters globally or locally to the buffer. The variable is set to
a string in the format "{filter label}\t{pattern};{pattern}\n" where {filter
+8 -5
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.2. Last change: 2021 Mar 28
*eval.txt* For Vim version 8.2. Last change: 2021 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1550,8 +1550,11 @@ the following ways:
The arguments are optional. Example: >
:let F = {-> 'error function'}
:echo F()
:echo F('ignored')
< error function
Note that in Vim9 script another kind of lambda can be used: |vim9-lambda|.
*closure*
Lambda expressions can access outer scope variables and arguments. This is
often called a closure. Example where "i" and "a:arg" are used in a lambda
@@ -1586,7 +1589,7 @@ The lambda expression is also useful for Channel, Job and timer: >
Handler called
Note how execute() is used to execute an Ex command. That's ugly though.
In Vim9 script you can use a command block, see |inline-function|.
Lambda expressions have internal names like '<lambda>42'. If you get an error
for a lambda expression, you can find what it is with the following command: >
@@ -6099,7 +6102,7 @@ getwininfo([{winid}]) *getwininfo()*
tab pages is returned.
Each List item is a |Dictionary| with the following entries:
botline last displayed buffer line
botline last complete displayed buffer line
bufnr number of buffer in the window
height window height (excluding winbar)
loclist 1 if showing a location list
@@ -11880,7 +11883,7 @@ gui_macvim Compiled with MacVim GUI.
gui_motif Compiled with Motif GUI.
gui_photon Compiled with Photon GUI.
gui_running Vim is running in the GUI, or it will start soon.
gui_win32 Compiled with MS Windows Win32 GUI.
gui_win32 Compiled with MS-Windows Win32 GUI.
gui_win32s idem, and Win32s system being used (Windows 3.1)
haiku Haiku version of Vim.
hangul_input Compiled with Hangul input support. |hangul|
+64
View File
@@ -0,0 +1,64 @@
*ps1.txt* A Windows PowerShell syntax plugin for Vim
Author: Peter Provost <https://www.github.com/PProvost>
License: Apache 2.0
URL: https://github.com/PProvost/vim-ps1
INTRODUCTION *ps1-syntax*
This plugin provides Vim syntax, indent and filetype detection for Windows
PowerShell scripts, modules, and XML configuration files.
ABOUT *ps1-about*
Grab the latest version or report a bug on GitHub:
https://github.com/PProvost/vim-ps1
FOLDING *ps1-folding*
The ps1 syntax file provides syntax folding (see |:syn-fold|) for script blocks
and digital signatures in scripts.
When 'foldmethod' is set to "syntax" then function script blocks will be
folded unless you use the following in your .vimrc or before opening a script: >
:let g:ps1_nofold_blocks = 1
<
Digital signatures in scripts will also be folded unless you use: >
:let g:ps1_nofold_sig = 1
<
Note: syntax folding might slow down syntax highlighting significantly,
especially for large files.
COMPILER *ps1-compiler*
The powershell `:compiler` script configures |:make| to execute the script in
PowerShell.
It tries to pick a smart default PowerShell command: `pwsh` if available and
`powershell` otherwise, but you can customize the command: >
:let g:ps1_makeprg_cmd = '/path/to/pwsh'
<
To configure whether to show the exception type information: >
:let g:ps1_efm_show_error_categories = 1
<
KEYWORD LOOKUP *ps1-keyword*
To look up keywords using PowerShell's Get-Help, press the |K| key. For more
convenient paging, the pager `less` should be installed, which is included in
many Linux distributions and in macOS.
Many other distributions are available for Windows like
https://chocolatey.org/packages/less/. Make sure `less` is in a directory
listed in the `PATH` environment variable, which chocolatey above does.
------------------------------------------------------------------------------
vim:ft=help:
+2 -2
View File
@@ -1,4 +1,4 @@
*gui_w32.txt* For Vim version 8.2. Last change: 2020 Mar 25
*gui_w32.txt* For Vim version 8.2. Last change: 2021 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -403,7 +403,7 @@ The "File/Print" menu prints the text with syntax highlighting, see
printer installed this should also work: >
:w >>prn
Vim supports a number of standard MS Windows features. Some of these are
Vim supports a number of standard MS-Windows features. Some of these are
detailed elsewhere: see |'mouse'|, |win32-hidden-menus|.
*drag-n-drop-win32*
+3 -1
View File
@@ -1,4 +1,4 @@
*if_lua.txt* For Vim version 8.2. Last change: 2020 Jun 28
*if_lua.txt* For Vim version 8.2. Last change: 2021 Apr 07
VIM REFERENCE MANUAL by Luis Carvalho
@@ -208,6 +208,8 @@ Vim evaluation and command execution, and others.
created on demand. Example: >
:lua print(vim.fn.has('timers'))
<
vim.lua_version The Lua version Vim was compiled with, in the
form {major}.{minor}.{patch}, e.g. "5.1.4".
==============================================================================
3. List userdata *lua-list*
+2 -2
View File
@@ -1,4 +1,4 @@
*mbyte.txt* For Vim version 8.2. Last change: 2020 Aug 15
*mbyte.txt* For Vim version 8.2. Last change: 2021 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar et al.
@@ -770,7 +770,7 @@ is suitable for complex input, such as CJK.
of the two ways: FrontEnd system and BackEnd system. In the FrontEnd
system, input events are snatched by the |IM-server| first, then |IM-server|
give the application the result of input. On the other hand, the BackEnd
system works reverse order. MS Windows adopt BackEnd system. In X, most of
system works reverse order. MS-Windows adopt BackEnd system. In X, most of
|IM-server|s adopt FrontEnd system. The demerit of BackEnd system is the
large overhead in communication, but it provides safe synchronization with
no restrictions on applications.
+18 -10
View File
@@ -1,4 +1,4 @@
*options.txt* For Vim version 8.2. Last change: 2021 Mar 29
*options.txt* For Vim version 8.2. Last change: 2021 Apr 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -4243,7 +4243,7 @@ A jump table for the options with a short description can be found at |Q_op|.
the window. This happens only when the 'icon' option is on.
Only works if the terminal supports setting window icon text
(currently only X11 GUI and terminals with a non-empty 't_IS' option).
Does not work for MS Windows.
Does not work for MS-Windows.
When Vim was compiled with HAVE_X11 defined, the original icon will be
restored if possible |X11|.
When this option contains printf-style '%' items, they will be
@@ -5168,7 +5168,7 @@ A jump table for the options with a short description can be found at |Q_op|.
jump between two double quotes.
The characters must be separated by a colon.
The pairs must be separated by a comma. Example for including '<' and
'>' (HTML): >
'>' (for HTML): >
:set mps+=<:>
< A more exotic example, to jump between the '=' and ';' in an
@@ -8934,23 +8934,31 @@ A jump table for the options with a short description can be found at |Q_op|.
part specifies what to do for each consecutive use of 'wildchar'. The
first part specifies the behavior for the first use of 'wildchar',
The second part for the second use, etc.
These are the possible values for each part:
Each part consists of a colon separated list consisting of the
following possible values:
"" Complete only the first match.
"full" Complete the next full match. After the last match,
the original string is used and then the first match
again.
again. Will also start 'wildmenu' if it is enabled.
"longest" Complete till longest common string. If this doesn't
result in a longer string, use the next part.
"longest:full" Like "longest", but also start 'wildmenu' if it is
enabled.
"list" When more than one match, list all matches.
"lastused" When completing buffer names and more than one buffer
matches, sort buffers by time last used (other than
the current buffer).
When there is only a single match, it is fully completed in all cases.
Examples of useful colon-separated values:
"longest:full" Like "longest", but also start 'wildmenu' if it is
enabled. Will not complete to the next full match.
"list:full" When more than one match, list all matches and
complete first match.
"list:longest" When more than one match, list all matches and
complete till longest common string.
"list:lastused" When more than one buffer matches, sort buffers
by time last used (other than the current buffer).
When there is only a single match, it is fully completed in all cases.
"list:lastused" When more than one buffer matches, list all matches
and sort buffers by time last used (other than the
current buffer).
Examples: >
:set wildmode=full
+2 -2
View File
@@ -1,4 +1,4 @@
*os_win32.txt* For Vim version 8.2. Last change: 2017 Mar 21
*os_win32.txt* For Vim version 8.2. Last change: 2021 Apr 05
VIM REFERENCE MANUAL by George Reilly
@@ -83,7 +83,7 @@ executable() returns 1 the executable can actually be executed.
Command line arguments *win32-cmdargs*
Analysis of a command line into parameters is not standardised in MS Windows.
Analysis of a command line into parameters is not standardised in MS-Windows.
Vim and gvim used to use different logic to parse it (before 7.4.432), and the
logic was also depended on what it was compiled with. Now Vim and gvim both
use the CommandLineToArgvW() Win32 API, so they behave in the same way.
+1 -1
View File
@@ -1,4 +1,4 @@
*syntax.txt* For Vim version 8.2. Last change: 2021 Mar 06
*syntax.txt* For Vim version 8.2. Last change: 2021 Apr 02
VIM REFERENCE MANUAL by Bram Moolenaar
+9
View File
@@ -5519,6 +5519,7 @@ assert_fails() testing.txt /*assert_fails()*
assert_false() testing.txt /*assert_false()*
assert_inrange() testing.txt /*assert_inrange()*
assert_match() testing.txt /*assert_match()*
assert_nobeep() testing.txt /*assert_nobeep()*
assert_notequal() testing.txt /*assert_notequal()*
assert_notmatch() testing.txt /*assert_notmatch()*
assert_report() testing.txt /*assert_report()*
@@ -7601,6 +7602,7 @@ info-message starting.txt /*info-message*
inform.vim syntax.txt /*inform.vim*
informix ft_sql.txt /*informix*
initialization starting.txt /*initialization*
inline-function vim9.txt /*inline-function*
input() eval.txt /*input()*
inputdialog() eval.txt /*inputdialog()*
inputlist() eval.txt /*inputlist()*
@@ -8729,6 +8731,12 @@ prop_type_change() textprop.txt /*prop_type_change()*
prop_type_delete() textprop.txt /*prop_type_delete()*
prop_type_get() textprop.txt /*prop_type_get()*
prop_type_list() textprop.txt /*prop_type_list()*
ps1-about ft_ps1.txt /*ps1-about*
ps1-compiler ft_ps1.txt /*ps1-compiler*
ps1-folding ft_ps1.txt /*ps1-folding*
ps1-keyword ft_ps1.txt /*ps1-keyword*
ps1-syntax ft_ps1.txt /*ps1-syntax*
ps1.txt ft_ps1.txt /*ps1.txt*
psql ft_sql.txt /*psql*
ptcap.vim syntax.txt /*ptcap.vim*
pterm-mouse options.txt /*pterm-mouse*
@@ -10285,6 +10293,7 @@ vim9-export vim9.txt /*vim9-export*
vim9-final vim9.txt /*vim9-final*
vim9-gotchas vim9.txt /*vim9-gotchas*
vim9-import vim9.txt /*vim9-import*
vim9-lambda vim9.txt /*vim9-lambda*
vim9-mix vim9.txt /*vim9-mix*
vim9-namespace vim9.txt /*vim9-namespace*
vim9-rationale vim9.txt /*vim9-rationale*
+1 -1
View File
@@ -1,4 +1,4 @@
*testing.txt* For Vim version 8.2. Last change: 2021 Mar 10
*testing.txt* For Vim version 8.2. Last change: 2021 Apr 02
VIM REFERENCE MANUAL by Bram Moolenaar
+5 -10
View File
@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.2. Last change: 2021 Mar 29
*todo.txt* For Vim version 8.2. Last change: 2021 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -42,17 +42,12 @@ Vim9 - Make everything work:
- For builtin functions using tv_get_string*() use check_for_string() to be
more strict about the argument type (not a bool).
done: balloon_()
- Run the same tests in :def and Vim9 script, like in Test_expr7_not()
- Check many more builtin function arguments at compile time.
- make 0 == 'string' fail on the script level, like inside :def.
- Check that when using a user function name without prefix, it does not find
a global function. Prefixing g: is required.
- Appending to dict item doesn't work in a :def function:
var d: dict<string> = {a: 'x'}
d['a'] ..= 'y'
d.a ..= 'y'
Test to be extended: Test_assign_dict_with_op()
- Using ".." at script level doesn't convert arguments to a string.
- This fails in a :def function but not at the script level:
var s = 'asdf'->((a) => a)('x')
Disallow passing more arguments to lambda than expected?
- Implement blob index and slice, also with assignment?
- Compile replacement of :s command: s/pat/\=expr/
- Compile redir to local variable: var_redir_start().
- Implement type cast at the script level.
+1 -1
View File
@@ -43,7 +43,7 @@ like:
|~ |
|"file.txt" [New file] |
+---------------------------------------+
('#" is the cursor position.)
('#' is the cursor position.)
The tilde (~) lines indicate lines not in the file. In other words, when Vim
runs out of file to display, it displays tilde lines. At the bottom of the
+3 -3
View File
@@ -1,4 +1,4 @@
*version5.txt* For Vim version 8.2. Last change: 2020 Dec 19
*version5.txt* For Vim version 8.2. Last change: 2021 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -405,7 +405,7 @@ Both of these are only available when enabled at compile time.
Win32 GUI version *added-win32-GUI*
-----------------
The GUI has been ported to MS Windows 95 and NT. All the features of the X11
The GUI has been ported to MS-Windows 95 and NT. All the features of the X11
GUI are available to Windows users now. |gui-w32|
This also fixes problems with running the Win32 console version under Windows
95, where console support has always been bad.
@@ -4403,7 +4403,7 @@ the last char of the line, "<<" moved an extra line. Also for other operators
that always work on lines.
link.sh changed "-lnsl_s" to "_s" when looking for "nsl" to be removed.
Now it only remove whole words.
Now it only removes whole words.
When jumped to a mark or using "fz", and there is an error, the current column
was lost. E.g. when using "$fzj".
+2 -2
View File
@@ -1,4 +1,4 @@
*version6.txt* For Vim version 8.2. Last change: 2021 Jan 17
*version6.txt* For Vim version 8.2. Last change: 2021 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1025,7 +1025,7 @@ Port to OS/390 Unix (Ralf Schandl)
Included jsbmouse support. (Darren Garth)
Support for dec mouse in Unix. (Steve Wall)
Port to 16-bit MS Windows (Windows 3.1x) (Vince Negri)
Port to 16-bit MS-Windows (Windows 3.1x) (Vince Negri)
Port to QNX. Supports the Photon GUI, mouse, etc. (Julian Kinraid)
+27 -9
View File
@@ -1,4 +1,4 @@
*vim9.txt* For Vim version 8.2. Last change: 2021 Mar 30
*vim9.txt* For Vim version 8.2. Last change: 2021 Apr 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -305,13 +305,21 @@ Variables, functions and function arguments cannot shadow previously defined
or imported variables and functions in the same script file.
Variables may shadow Ex commands, rename the variable if needed.
Global variables and user defined functions must be prefixed with "g:", also
at the script level. >
Global variables must be prefixed with "g:", also at the script level. >
vim9script
var script_local = 'text'
g:global = 'value'
var Funcref = g:ThatFunction
Global functions must be prefixed with "g:" when defining them, but can be
called without "g:". >
vim9script
def g:GlobalFunc(): string
return 'text'
enddef
echo GlobalFunc()
The "g:" prefix is not needed for auto-load functions.
Since `&opt = value` is now assigning a value to option "opt", ":&" cannot be
used to repeat a `:substitute` command.
@@ -401,7 +409,7 @@ number of arguments and any return type. The function can be defined later.
Lambda using => instead of -> ~
*vim9-lambda*
In legacy script there can be confusion between using "->" for a method call
and for a lambda. Also, when a "{" is found the parser needs to figure out if
it is the start of a lambda or a dictionary, which is now more complicated
@@ -425,12 +433,19 @@ But you can use a backslash to concatenate the lines before parsing: >
filter(list, (k,
\ v)
\ => v > 0)
< *inline-function*
Additionally, a lambda can contain statements in {}: >
var Lambda = (arg) => {
g:was_called = 'yes'
return expression
}
This can be useful for a timer, for example: >
var count = 0
var timer = timer_start(500, (_) => {
count += 1
echom 'Handler called ' .. count
}, {repeat: 3})
The ending "}" must be at the start of a line. It can be followed by other
characters, e.g.: >
@@ -836,7 +851,7 @@ Patterns are used like 'magic' is set, unless explicitly overruled.
The 'edcompatible' option value is not used.
The 'gdefault' option value is not used.
You may also find this wiki useful. It was written by an early adoptor of
You may also find this wiki useful. It was written by an early adopter of
Vim9 script: https://github.com/lacygoill/wiki/blob/master/vim/vim9.md
==============================================================================
@@ -881,14 +896,14 @@ THIS IS STILL UNDER DEVELOPMENT - ANYTHING CAN BREAK - ANYTHING CAN CHANGE
:enddef End of a function defined with `:def`. It should be on
a line by its own.
You may also find this wiki useful. It was written by an early adoptor of
You may also find this wiki useful. It was written by an early adopter of
Vim9 script: https://github.com/lacygoill/wiki/blob/master/vim/vim9.md
If the script the function is defined in is Vim9 script, then script-local
variables can be accessed without the "s:" prefix. They must be defined
before the function is compiled. If the script the function is defined in is
legacy script, then script-local variables must be accessed with the "s:"
prefix and they do not need to exist (they can be deleted any time).
prefix if they do not exist at the time of compiling.
*:defc* *:defcompile*
:defc[ompile] Compile functions defined in the current script that
@@ -1073,12 +1088,15 @@ dictionary. If there is a mix of types, the "any" type is used. >
['a', 'b', 'c'] list<string>
[1, 'x', 3] list<any>
For script-local variables in Vim9 script the type is checked, also when the
variable was declared in a legacy function.
Stricter type checking ~
*type-checking*
In legacy Vim script, where a number was expected, a string would be
automatically converted to a number. This was convenient for an actual number
such as "123", but leads to unexpected problems (but no error message) if the
such as "123", but leads to unexpected problems (and no error message) if the
string doesn't start with a number. Quite often this leads to hard-to-find
bugs.
+11 -4
View File
@@ -1,13 +1,13 @@
" Vim settings file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, 77, 66)
" Version: (v52) 2020 October 07
" Version: (v53) 2021 April 06
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
" Usage: For instructions, do :help fortran-plugin from Vim
" Credits:
" Version 0.1 was created in September 2000 by Ajit Thakkar.
" Since then, useful suggestions and contributions have been made, in order, by:
" Stefano Zacchiroli, Hendrik Merx, Ben Fritz, David Barnett, Eisuke Kawashima,
" and Doug Kearns.
" Doug Kearns, and Fritz Reese.
" Only do these settings when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -66,12 +66,19 @@ endif
" Set comments and textwidth according to source type
if (b:fortran_fixed_source == 1)
setlocal comments=:!,:*,:C
" Fixed format requires a textwidth of 72 for code
setlocal tw=72
" Fixed format requires a textwidth of 72 for code,
" but some vendor extensions allow longer lines
if exists("fortran_extended_line_length")
setlocal tw=132
elseif exists("fortran_cardimage_line_length")
setlocal tw=80
else
setlocal tw=72
" If you need to add "&" on continued lines so that the code is
" compatible with both free and fixed format, then you should do so
" in column 73 and uncomment the next line
" setlocal tw=73
endif
else
setlocal comments=:!
" Free format allows a textwidth of 132
+59
View File
@@ -0,0 +1,59 @@
" Vim filetype plugin file
" Language: Windows PowerShell
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2021 Apr 02
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
" Don't load another plug-in for this buffer
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
setlocal tw=0
setlocal commentstring=#%s
setlocal formatoptions=tcqro
" Enable autocompletion of hyphenated PowerShell commands,
" e.g. Get-Content or Get-ADUser
setlocal iskeyword+=-
" Change the browse dialog on Win32 to show mainly PowerShell-related files
if has("gui_win32")
let b:browsefilter =
\ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" .
\ "PowerShell Script Files (*.ps1)\t*.ps1\n" .
\ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" .
\ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n" .
\ "All Files (*.*)\t*.*\n"
endif
" Look up keywords by Get-Help:
" check for PowerShell Core in Windows, Linux or MacOS
if executable('pwsh') | let s:pwsh_cmd = 'pwsh'
" on Windows Subsystem for Linux, check for PowerShell Core in Windows
elseif exists('$WSLENV') && executable('pwsh.exe') | let s:pwsh_cmd = 'pwsh.exe'
" check for PowerShell <= 5.1 in Windows
elseif executable('powershell.exe') | let s:pwsh_cmd = 'powershell.exe'
endif
if exists('s:pwsh_cmd')
if !has('gui_running') && executable('less') &&
\ !(exists('$ConEmuBuild') && &term =~? '^xterm')
" For exclusion of ConEmu, see https://github.com/Maximus5/ConEmu/issues/2048
command! -buffer -nargs=1 GetHelp silent exe '!' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>" | ' . (has('unix') ? 'LESS= less' : 'less') | redraw!
elseif has('terminal')
command! -buffer -nargs=1 GetHelp silent exe 'term ' . s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full "<args>"' . (executable('less') ? ' | less' : '')
else
command! -buffer -nargs=1 GetHelp echo system(s:pwsh_cmd . ' -NoLogo -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -Command Get-Help -Full <args>')
endif
endif
setlocal keywordprg=:GetHelp
" Undo the stuff we changed
let b:undo_ftplugin = "setlocal tw< cms< fo< iskeyword< keywordprg<" .
\ " | unlet! b:browsefilter"
let &cpo = s:cpo_save
unlet s:cpo_save
+34
View File
@@ -0,0 +1,34 @@
" Vim filetype plugin file
" Language: Windows PowerShell
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2021 Apr 02
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
" Don't load another plug-in for this buffer
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
setlocal tw=0
setlocal commentstring=#%s
setlocal formatoptions=tcqro
" Change the browse dialog on Win32 to show mainly PowerShell-related files
if has("gui_win32")
let b:browsefilter =
\ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" .
\ "PowerShell Script Files (*.ps1)\t*.ps1\n" .
\ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" .
\ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n" .
\ "All Files (*.*)\t*.*\n"
endif
" Undo the stuff we changed
let b:undo_ftplugin = "setlocal tw< cms< fo<" .
\ " | unlet! b:browsefilter"
let &cpo = s:cpo_save
unlet s:cpo_save
+17
View File
@@ -0,0 +1,17 @@
" Vim indent file
" Language: Windows PowerShell
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2017 Oct 19
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" smartindent is good enough for powershell
setlocal smartindent
" disable the indent removal for # marks
inoremap <buffer> # X#
let b:undo_indent = "setl si<"
+4 -3
View File
@@ -1,6 +1,6 @@
" Vim plugin for showing matching parens
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Jun 18
" Last Change: 2021 Apr 07
" Exit quickly when:
" - this plugin was already loaded (or disabled)
@@ -107,9 +107,10 @@ func s:Highlight_Matching_Pair()
" Build an expression that detects whether the current cursor position is
" in certain syntax types (string, comment, etc.), for use as
" searchpairpos()'s skip argument.
" We match "escape" for special items, such as lispEscapeSpecial.
" We match "escape" for special items, such as lispEscapeSpecial, and
" match "symbol" for lispBarSymbol.
let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' .
\ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))'
\ '''v:val =~? "string\\|character\\|singlequote\\|escape\\symbol\\|comment"''))'
" If executing the expression determines that the cursor is currently in
" one of the syntax types, then we want searchpairpos() to find the pair
" within those syntax types (i.e., not skip). Otherwise, the cursor is
+13 -6
View File
@@ -1,6 +1,6 @@
" Vim syntax file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
" Version: (v103) 2020 October 07
" Version: (v104) 2021 April 06
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
" Usage: For instructions, do :help fortran-syntax from Vim
" Credits:
@@ -8,10 +8,10 @@
" older Fortran 77 syntax file by Mario Eusebio and Preben Guldberg.
" Since then, useful suggestions and contributions have been made, in order, by:
" Andrej Panjkov, Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile,
" Walter Dieudonné, Alexander Wagner, Roman Bertle, Charles Rendleman,
" Walter Dieudonne, Alexander Wagner, Roman Bertle, Charles Rendleman,
" Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, Jan Hermann,
" Stefano Zaghi, Vishnu V. Krishnan, Judicaël Grasset, Takuma Yoshida,
" Eisuke Kawashima, and André Chalella.`
" Stefano Zaghi, Vishnu V. Krishnan, Judicael Grasset, Takuma Yoshida,
" Eisuke Kawashima, Andre Chalella, and Fritz Reese.
if exists("b:current_syntax")
finish
@@ -360,8 +360,15 @@ syn cluster fortranCommentGroup contains=fortranTodo
if (b:fortran_fixed_source == 1)
if !exists("fortran_have_tabs")
"Flag items beyond column 72
syn match fortranSerialNumber excludenl "^.\{73,}$"lc=72
" Fixed format requires a textwidth of 72 for code,
" but some vendor extensions allow longer lines
if exists("fortran_extended_line_length")
syn match fortranSerialNumber excludenl "^.\{133,}$"lc=132
elseif exists("fortran_cardimage_line_length")
syn match fortranSerialNumber excludenl "^.\{81,}$"lc=80
else
syn match fortranSerialNumber excludenl "^.\{73,}$"lc=72
endif
"Flag left margin errors
syn match fortranLabelError "^.\{-,4}[^0-9 ]" contains=fortranTab
syn match fortranLabelError "^.\{4}\d\S"
+3 -2
View File
@@ -3,7 +3,7 @@
" Maintainer: Andrii Sokolov <andriy145@gmail.com>
" Original Author: Manuel M.H. Stol <Manuel.Stol@allieddata.nl>
" Former Maintainer: Manuel M.H. Stol <Manuel.Stol@allieddata.nl>
" Contributors: Leonard König <leonard.r.koenig@gmail.com> (C string highlighting)
" Contributors: Leonard König <leonard.r.koenig@gmail.com> (C string highlighting), Peter Stanhope <dev.rptr@gmail.com> (Add missing 64-bit mode registers)
" Last Change: 2017 Jan 23
" NASM Home: http://www.nasm.us/
@@ -240,7 +240,8 @@ syn cluster nasmGrpPreProcs contains=nasmMacroDef,@nasmGrpInMacros,@nasmGrpPreCo
syn match nasmGen08Register "\<[A-D][HL]\>"
syn match nasmGen16Register "\<\([A-D]X\|[DS]I\|[BS]P\)\>"
syn match nasmGen32Register "\<E\([A-D]X\|[DS]I\|[BS]P\)\>"
syn match nasmGen64Register "\<R\([A-D]X\|[DS]I\|[BS]P\|[89]\|1[0-5]\|[89][WD]\|1[0-5][WD]\)\>"
syn match nasmGen64Register "\<R\([A-D]X\|[DS]I\|[BS]P\|[89]\|1[0-5]\|[89][WDB]\|1[0-5][WDB]\)\>"
syn match nasmExtRegister "\<\([SB]PL\|[SD]IL\)\>"
syn match nasmSegRegister "\<[C-GS]S\>"
syn match nasmSpcRegister "\<E\=IP\>"
syn match nasmFpuRegister "\<ST\o\>"
+182
View File
@@ -0,0 +1,182 @@
" Vim syntax file
" Language: Windows PowerShell
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2020 Nov 24
"
" The following settings are available for tuning syntax highlighting:
" let ps1_nofold_blocks = 1
" let ps1_nofold_sig = 1
" let ps1_nofold_region = 1
if exists("b:current_syntax")
finish
endif
" Operators contain dashes
setlocal iskeyword+=-
" PowerShell doesn't care about case
syn case ignore
" Sync-ing method
syn sync minlines=100
" Certain tokens can't appear at the top level of the document
syn cluster ps1NotTop contains=@ps1Comment,ps1CDocParam,ps1FunctionDeclaration
" Comments and special comment words
syn keyword ps1CommentTodo TODO FIXME XXX TBD HACK NOTE contained
syn match ps1CDocParam /.*/ contained
syn match ps1CommentDoc /^\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained
syn match ps1CommentDoc /#\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained
syn match ps1Comment /#.*/ contains=ps1CommentTodo,ps1CommentDoc,@Spell
syn region ps1Comment start="<#" end="#>" contains=ps1CommentTodo,ps1CommentDoc,@Spell
" Language keywords and elements
syn keyword ps1Conditional if else elseif switch default
syn keyword ps1Repeat while for do until break continue foreach in
syn match ps1Repeat /\<foreach\>/ nextgroup=ps1Block skipwhite
syn match ps1Keyword /\<while\>/ nextgroup=ps1Block skipwhite
syn match ps1Keyword /\<where\>/ nextgroup=ps1Block skipwhite
syn keyword ps1Exception begin process end exit inlinescript parallel sequence
syn keyword ps1Keyword try catch finally throw
syn keyword ps1Keyword return filter in trap param data dynamicparam
syn keyword ps1Constant $true $false $null
syn match ps1Constant +\$?+
syn match ps1Constant +\$_+
syn match ps1Constant +\$\$+
syn match ps1Constant +\$^+
" Keywords reserved for future use
syn keyword ps1Keyword class define from using var
" Function declarations
syn keyword ps1Keyword function nextgroup=ps1Function skipwhite
syn keyword ps1Keyword filter nextgroup=ps1Function skipwhite
syn keyword ps1Keyword workflow nextgroup=ps1Function skipwhite
syn keyword ps1Keyword configuration nextgroup=ps1Function skipwhite
syn keyword ps1Keyword class nextgroup=ps1Function skipwhite
syn keyword ps1Keyword enum nextgroup=ps1Function skipwhite
" Function declarations and invocations
syn match ps1Cmdlet /\v(add|clear|close|copy|enter|exit|find|format|get|hide|join|lock|move|new|open|optimize|pop|push|redo|remove|rename|reset|search|select|Set|show|skip|split|step|switch|undo|unlock|watch)(-\w+)+/ contained
syn match ps1Cmdlet /\v(connect|disconnect|read|receive|send|write)(-\w+)+/ contained
syn match ps1Cmdlet /\v(backup|checkpoint|compare|compress|convert|convertfrom|convertto|dismount|edit|expand|export|group|import|initialize|limit|merge|mount|out|publish|restore|save|sync|unpublish|update)(-\w+)+/ contained
syn match ps1Cmdlet /\v(debug|measure|ping|repair|resolve|test|trace)(-\w+)+/ contained
syn match ps1Cmdlet /\v(approve|assert|build|complete|confirm|deny|deploy|disable|enable|install|invoke|register|request|restart|resume|start|stop|submit|suspend|uninstall|unregister|wait)(-\w+)+/ contained
syn match ps1Cmdlet /\v(block|grant|protect|revoke|unblock|unprotect)(-\w+)+/ contained
syn match ps1Cmdlet /\v(use)(-\w+)+/ contained
" Other functions
syn match ps1Function /\w\+\(-\w\+\)\+/ contains=ps1Cmdlet
" Type declarations
syn match ps1Type /\[[a-z_][a-z0-9_.,\[\]]\+\]/
" Variable references
syn match ps1ScopeModifier /\(global:\|local:\|private:\|script:\)/ contained
syn match ps1Variable /\$\w\+\(:\w\+\)\?/ contains=ps1ScopeModifier
syn match ps1Variable /\${\w\+\(:\?[[:alnum:]_()]\+\)\?}/ contains=ps1ScopeModifier
" Operators
syn keyword ps1Operator -eq -ne -ge -gt -lt -le -like -notlike -match -notmatch -replace -split -contains -notcontains
syn keyword ps1Operator -ieq -ine -ige -igt -ile -ilt -ilike -inotlike -imatch -inotmatch -ireplace -isplit -icontains -inotcontains
syn keyword ps1Operator -ceq -cne -cge -cgt -clt -cle -clike -cnotlike -cmatch -cnotmatch -creplace -csplit -ccontains -cnotcontains
syn keyword ps1Operator -in -notin
syn keyword ps1Operator -is -isnot -as -join
syn keyword ps1Operator -and -or -not -xor -band -bor -bnot -bxor
syn keyword ps1Operator -f
syn match ps1Operator /!/
syn match ps1Operator /=/
syn match ps1Operator /+=/
syn match ps1Operator /-=/
syn match ps1Operator /\*=/
syn match ps1Operator /\/=/
syn match ps1Operator /%=/
syn match ps1Operator /+/
syn match ps1Operator /-\(\s\|\d\|\.\|\$\|(\)\@=/
syn match ps1Operator /\*/
syn match ps1Operator /\//
syn match ps1Operator /|/
syn match ps1Operator /%/
syn match ps1Operator /&/
syn match ps1Operator /::/
syn match ps1Operator /,/
syn match ps1Operator /\(^\|\s\)\@<=\. \@=/
" Regular Strings
" These aren't precisely correct and could use some work
syn region ps1String start=/"/ skip=/`"/ end=/"/ contains=@ps1StringSpecial,@Spell
syn region ps1String start=/'/ skip=/''/ end=/'/
" Here-Strings
syn region ps1String start=/@"$/ end=/^"@/ contains=@ps1StringSpecial,@Spell
syn region ps1String start=/@'$/ end=/^'@/
" Interpolation
syn match ps1Escape /`./
syn region ps1Interpolation matchgroup=ps1InterpolationDelimiter start="$(" end=")" contained contains=ALLBUT,@ps1NotTop
syn region ps1NestedParentheses start="(" skip="\\\\\|\\)" matchgroup=ps1Interpolation end=")" transparent contained
syn cluster ps1StringSpecial contains=ps1Escape,ps1Interpolation,ps1Variable,ps1Boolean,ps1Constant,ps1BuiltIn,@Spell
" Numbers
syn match ps1Number "\(\<\|-\)\@<=\(0[xX]\x\+\|\d\+\)\([KMGTP][B]\)\=\(\>\|-\)\@="
syn match ps1Number "\(\(\<\|-\)\@<=\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[dD]\="
syn match ps1Number "\<\d\+[eE][-+]\=\d\+[dD]\=\>"
syn match ps1Number "\<\d\+\([eE][-+]\=\d\+\)\=[dD]\>"
" Constants
syn match ps1Boolean "$\%(true\|false\)\>"
syn match ps1Constant /\$null\>/
syn match ps1BuiltIn "$^\|$?\|$_\|$\$"
syn match ps1BuiltIn "$\%(args\|error\|foreach\|home\|input\)\>"
syn match ps1BuiltIn "$\%(match\(es\)\?\|myinvocation\|host\|lastexitcode\)\>"
syn match ps1BuiltIn "$\%(ofs\|shellid\|stacktrace\)\>"
" Named Switch
syn match ps1Label /\s-\w\+/
" Folding blocks
if !exists('g:ps1_nofold_blocks')
syn region ps1Block start=/{/ end=/}/ transparent fold
endif
if !exists('g:ps1_nofold_region')
syn region ps1Region start=/#region/ end=/#endregion/ transparent fold keepend extend
endif
if !exists('g:ps1_nofold_sig')
syn region ps1Signature start=/# SIG # Begin signature block/ end=/# SIG # End signature block/ transparent fold
endif
" Setup default color highlighting
hi def link ps1Number Number
hi def link ps1Block Block
hi def link ps1Region Region
hi def link ps1Exception Exception
hi def link ps1Constant Constant
hi def link ps1String String
hi def link ps1Escape SpecialChar
hi def link ps1InterpolationDelimiter Delimiter
hi def link ps1Conditional Conditional
hi def link ps1Cmdlet Function
hi def link ps1Function Identifier
hi def link ps1Variable Identifier
hi def link ps1Boolean Boolean
hi def link ps1Constant Constant
hi def link ps1BuiltIn StorageClass
hi def link ps1Type Type
hi def link ps1ScopeModifier StorageClass
hi def link ps1Comment Comment
hi def link ps1CommentTodo Todo
hi def link ps1CommentDoc Tag
hi def link ps1CDocParam Identifier
hi def link ps1Operator Operator
hi def link ps1Repeat Repeat
hi def link ps1RepeatAndCmdlet Repeat
hi def link ps1Keyword Keyword
hi def link ps1KeywordAndCmdlet Keyword
hi def link ps1Label Label
let b:current_syntax = "ps1"
+51
View File
@@ -0,0 +1,51 @@
" Vim syntax file
" Language: Windows PowerShell
" URL: https://github.com/PProvost/vim-ps1
" Last Change: 2013 Jun 24
if exists("b:current_syntax")
finish
endif
let s:ps1xml_cpo_save = &cpo
set cpo&vim
doau syntax xml
unlet b:current_syntax
syn case ignore
syn include @ps1xmlScriptBlock <sfile>:p:h/ps1.vim
unlet b:current_syntax
syn region ps1xmlScriptBlock
\ matchgroup=xmlTag start="<Script>"
\ matchgroup=xmlEndTag end="</Script>"
\ fold
\ contains=@ps1xmlScriptBlock
\ keepend
syn region ps1xmlScriptBlock
\ matchgroup=xmlTag start="<ScriptBlock>"
\ matchgroup=xmlEndTag end="</ScriptBlock>"
\ fold
\ contains=@ps1xmlScriptBlock
\ keepend
syn region ps1xmlScriptBlock
\ matchgroup=xmlTag start="<GetScriptBlock>"
\ matchgroup=xmlEndTag end="</GetScriptBlock>"
\ fold
\ contains=@ps1xmlScriptBlock
\ keepend
syn region ps1xmlScriptBlock
\ matchgroup=xmlTag start="<SetScriptBlock>"
\ matchgroup=xmlEndTag end="</SetScriptBlock>"
\ fold
\ contains=@ps1xmlScriptBlock
\ keepend
syn cluster xmlRegionHook add=ps1xmlScriptBlock
let b:current_syntax = "ps1xml"
let &cpo = s:ps1xml_cpo_save
unlet s:ps1xml_cpo_save
+10
View File
@@ -834,6 +834,16 @@ vim_isIDc(int c)
return (c > 0 && c < 0x100 && (g_chartab[c] & CT_ID_CHAR));
}
/*
* Like vim_isIDc() but not using the 'isident' option: letters, numbers and
* underscore.
*/
int
vim_isNormalIDc(int c)
{
return ASCII_ISALNUM(c) || c == '_';
}
/*
* return TRUE if 'c' is a keyword character: Letters and characters from
* 'iskeyword' option for the current buffer.
+1
View File
@@ -4153,6 +4153,7 @@ ex_substitute(exarg_T *eap)
if (curwin->w_cursor.col < 0)
curwin->w_cursor.col = 0;
getvcol(curwin, &curwin->w_cursor, NULL, NULL, &ec);
curwin->w_cursor.col = regmatch.startpos[0].col;
if (subflags.do_number || curwin->w_p_nu)
{
int numw = number_width(curwin) + 1;
+12 -3
View File
@@ -1710,10 +1710,19 @@ getcmdline_int(
#ifdef FEAT_STL_OPT
// Redraw the statusline in case it uses the current mode using the mode()
// function.
if (!cmd_silent && msg_scrolled == 0 && *p_stl != NUL)
if (!cmd_silent && msg_scrolled == 0)
{
curwin->w_redr_status = TRUE;
redraw_statuslines();
int found_one = FALSE;
win_T *wp;
FOR_ALL_WINDOWS(wp)
if (*p_stl != NUL || *wp->w_p_stl != NUL)
{
wp->w_redr_status = TRUE;
found_one = TRUE;
}
if (found_one)
redraw_statuslines();
}
#endif
+23
View File
@@ -24,6 +24,12 @@
#define LUAVIM_EVALNAME "luaeval"
#define LUAVIM_EVALHEADER "local _A=select(1,...) return "
#ifdef LUA_RELEASE
# define LUAVIM_VERSION LUA_RELEASE
#else
# define LUAVIM_VERSION LUA_VERSION
#endif
typedef buf_T *luaV_Buffer;
typedef win_T *luaV_Window;
typedef dict_T *luaV_Dict;
@@ -2087,6 +2093,7 @@ static const luaL_Reg luaV_module[] = {
{"open", luaV_open},
{"type", luaV_type},
{"call", luaV_call},
{"lua_version", NULL},
{NULL, NULL}
};
@@ -2168,6 +2175,20 @@ luaV_setref(lua_State *L)
return 1;
}
static int
luaV_pushversion(lua_State *L)
{
int major = 0;
int minor = 0;
int patch = 0;
char s[16];
sscanf(LUAVIM_VERSION, "Lua %d.%d.%d", &major, &minor, &patch);
vim_snprintf(s, sizeof(s), "%d.%d.%d", major, minor, patch);
lua_pushstring(L, s);
return 0;
}
#define LUA_VIM_FN_CODE \
"vim.fn = setmetatable({}, {\n"\
" __index = function (t, key)\n"\
@@ -2298,6 +2319,8 @@ luaopen_vim(lua_State *L)
lua_newtable(L); // vim table
lua_pushvalue(L, 1); // cache table
luaV_openlib(L, luaV_module, 1);
luaV_pushversion(L);
lua_setfield(L, -2, "lua_version");
lua_setglobal(L, LUAVIM_NAME);
// custom code
(void)luaL_dostring(L, LUA_VIM_FN_CODE);
+8 -1
View File
@@ -894,6 +894,7 @@ list_extend(list_T *l1, list_T *l2, listitem_T *bef)
{
listitem_T *item;
int todo;
listitem_T *bef_prev;
// NULL list is equivalent to an empty list: nothing to do.
if (l2 == NULL || l2->lv_len == 0)
@@ -903,9 +904,15 @@ list_extend(list_T *l1, list_T *l2, listitem_T *bef)
CHECK_LIST_MATERIALIZE(l1);
CHECK_LIST_MATERIALIZE(l2);
// When exending a list with itself, at some point we run into the item
// that was before "bef" and need to skip over the already inserted items
// to "bef".
bef_prev = bef == NULL ? NULL : bef->li_prev;
// We also quit the loop when we have inserted the original item count of
// the list, avoid a hang when we extend a list with itself.
for (item = l2->lv_first; item != NULL && --todo >= 0; item = item->li_next)
for (item = l2->lv_first; item != NULL && --todo >= 0;
item = item == bef_prev ? bef : item->li_next)
if (list_insert_tv(l1, &item->li_tv, bef) == FAIL)
return FAIL;
return OK;
+7 -7
View File
@@ -1545,14 +1545,14 @@ utf_char2cells(int c)
{0x1f6e9, 0x1f6e9},
{0x1f6f0, 0x1f6f0},
{0x1f6f3, 0x1f6f3}
#ifdef FEAT_GUI_MACVIM
#ifdef MACOS_X
// Include SF Symbols characters, which should be rendered as
// double-width. All of them are in the Supplementary Private Use Area-B
// range. The exact range was determined by downloading the "SF Symbols"
// app from Apple, and then selecting all symbols, copying them out, and
// inspecting the unicode values of them.
,
{0x100000, 0x100d7f}
// double-width. All of them are in the Supplementary Private Use
// Area-B range. The exact range was determined by downloading the "SF
// Symbols" app from Apple, and then selecting all symbols, copying
// them out, and inspecting the unicode values of them.
, {0x100000, 0x100d7f}
#endif
};
+3 -3
View File
@@ -2833,7 +2833,7 @@ find_special_key(
// Find end of modifier list
last_dash = src;
for (bp = src + 1; *bp == '-' || vim_isIDc(*bp); bp++)
for (bp = src + 1; *bp == '-' || vim_isNormalIDc(*bp); bp++)
{
if (*bp == '-')
{
@@ -3128,10 +3128,10 @@ get_special_key_code(char_u *name)
for (i = 0; key_names_table[i].name != NULL; i++)
{
table_name = key_names_table[i].name;
for (j = 0; vim_isIDc(name[j]) && table_name[j] != NUL; j++)
for (j = 0; vim_isNormalIDc(name[j]) && table_name[j] != NUL; j++)
if (TOLOWER_ASC(table_name[j]) != TOLOWER_ASC(name[j]))
break;
if (!vim_isIDc(name[j]) && table_name[j] == NUL)
if (!vim_isNormalIDc(name[j]) && table_name[j] == NUL)
return key_names_table[i].key;
}
return 0;
+1 -1
View File
@@ -3049,7 +3049,7 @@ msgstr "-T <term>\tR
msgid "--not-a-term\t\tSkip warning for input/output not being a terminal"
msgstr ""
"--no-a-term\t\tAucun avertissement si l'entrée/sortie n'est pas un terminal"
"--not-a-term\t\tAucun avertissement si l'entrée/sortie n'est pas un terminal"
msgid "--ttyfail\t\tExit if input or output is not a terminal"
msgstr "--ttyfail\t\tQuitte si l'entrée ou la sortie ne sont pas un terminal"
+1
View File
@@ -19,6 +19,7 @@ int linetabsize(char_u *s);
int linetabsize_col(int startcol, char_u *s);
int win_linetabsize(win_T *wp, char_u *line, colnr_T len);
int vim_isIDc(int c);
int vim_isNormalIDc(int c);
int vim_iswordc(int c);
int vim_iswordc_buf(int c, buf_T *buf);
int vim_iswordp(char_u *p);
-1
View File
@@ -1,5 +1,4 @@
/* vim9compile.c */
int script_var_exists(char_u *name, size_t len, int vim9script, cctx_T *cctx);
int check_defined(char_u *p, size_t len, cctx_T *cctx, int is_arg);
int check_compare_types(exprtype_T type, typval_T *tv1, typval_T *tv2);
int use_typecheck(type_T *actual, type_T *expected);
@@ -1,5 +1,7 @@
> +0&#ffffff0@49
|~+0#4040ff13&| @48
|~| @48
|-+3#0000000&|n|-| @46
|++3#0000000&|n|+| @46
| +0&&@49
|~+0#4040ff13&| @48
|-+1#0000000&|n|-| @46
| +0&&@49
@@ -1,5 +1,7 @@
| +0&#ffffff0@49
|~+0#4040ff13&| @48
|~| @48
|-+3#0000000&|c|-| @46
|++3#0000000&|c|+| @46
| +0&&@49
|~+0#4040ff13&| @48
|-+1#0000000&|c|-| @46
|:+0&&> @48
+3
View File
@@ -77,6 +77,9 @@ func Test_Ex_substitute()
call WaitForAssert({-> assert_match(' 1 foo foo', term_getline(buf, 5))},
\ 1000)
call WaitForAssert({-> assert_match(' ^^^', term_getline(buf, 6))}, 1000)
call term_sendkeys(buf, "N\<CR>")
call term_wait(buf)
call WaitForAssert({-> assert_match(' ^^^', term_getline(buf, 6))}, 1000)
call term_sendkeys(buf, "n\<CR>")
call WaitForAssert({-> assert_match(' ^^^', term_getline(buf, 6))},
\ 1000)
+14
View File
@@ -862,6 +862,20 @@ func Test_listdict_extend()
" Extend g: dictionary with an invalid variable name
call assert_fails("call extend(g:, {'-!' : 10})", 'E461:')
" Extend a list with itself.
let l = [1, 5, 7]
call extend(l, l, 0)
call assert_equal([1, 5, 7, 1, 5, 7], l)
let l = [1, 5, 7]
call extend(l, l, 1)
call assert_equal([1, 1, 5, 7, 5, 7], l)
let l = [1, 5, 7]
call extend(l, l, 2)
call assert_equal([1, 5, 1, 5, 7, 7], l)
let l = [1, 5, 7]
call extend(l, l, 3)
call assert_equal([1, 5, 7, 1, 5, 7], l)
endfunc
func Test_listdict_extendnew()
+1 -12
View File
@@ -13,18 +13,7 @@ CheckFeature lua
CheckFeature float
" Depending on the lua version, the error messages are different.
let s:luaver = split(split(systemlist('lua -v')[0], ' ')[1], '\.')
if len(s:luaver) < 3
" Didn't get something that looks like a version, use _VERSION.
let s:luaver = split(split(luaeval('_VERSION'), ' ')[1], '\.')
endif
let s:major = str2nr(s:luaver[0])
let s:minor = str2nr(s:luaver[1])
if len(s:luaver) >= 3
let s:patch = str2nr(s:luaver[2])
else
let s:patch = 0
endif
let [s:major, s:minor, s:patch] = luaeval('vim.lua_version')->split('\.')->map({-> str2nr(v:val)})
let s:lua_53_or_later = 0
let s:lua_543_or_later = 0
if (s:major == 5 && s:minor >= 3) || s:major > 5
+4 -1
View File
@@ -445,9 +445,12 @@ func Test_list_mappings()
" Remove default mappings
imapclear
inoremap <C-M> CtrlM
" reset 'isident' to check it isn't used
set isident=
inoremap <C-m> CtrlM
inoremap <A-S> AltS
inoremap <S-/> ShiftSlash
set isident&
call assert_equal([
\ 'i <S-/> * ShiftSlash',
\ 'i <M-S> * AltS',
+5 -4
View File
@@ -452,19 +452,20 @@ func Test_statusline_using_mode()
CheckScreendump
let lines =<< trim END
set laststatus=2
let &statusline = '-%{mode()}-'
setlocal statusline=-%{mode()}-
split
setlocal statusline=+%{mode()}+
END
call writefile(lines, 'XTest_statusline')
let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 5, 'cols': 50})
let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 7, 'cols': 50})
call VerifyScreenDump(buf, 'Test_statusline_mode_1', {})
call term_sendkeys(buf, ":")
call VerifyScreenDump(buf, 'Test_statusline_mode_2', {})
" clean up
call term_sendkeys(buf, "\<CR>")
call term_sendkeys(buf, "close\<CR>")
call StopVimInTerminal(buf)
call delete('XTest_statusline')
endfunc
+1 -1
View File
@@ -150,7 +150,7 @@ func Test_default_arg()
call assert_equal(res['0'], 1)
call assert_fails("call MakeBadFunc()", 'E989:')
call assert_fails("fu F(a=1 ,) | endf", 'E475:')
call assert_fails("fu F(a=1 ,) | endf", 'E1068:')
let d = Args2(7, v:none, 9)
call assert_equal([7, 2, 9], [d.a, d.b, d.c])
+35
View File
@@ -1476,6 +1476,41 @@ def Test_var_declaration_fails()
CheckDefFailure(['const foo: number'], 'E1021:')
enddef
def Test_script_local_in_legacy()
# OK to define script-local later when prefixed with s:
var lines =<< trim END
def SetLater()
s:legacy = 'two'
enddef
defcompile
let s:legacy = 'one'
call SetLater()
call assert_equal('two', s:legacy)
END
CheckScriptSuccess(lines)
# OK to leave out s: prefix when script-local already defined
lines =<< trim END
let s:legacy = 'one'
def SetNoPrefix()
legacy = 'two'
enddef
call SetNoPrefix()
call assert_equal('two', s:legacy)
END
CheckScriptSuccess(lines)
# Not OK to leave out s: prefix when script-local defined later
lines =<< trim END
def SetLaterNoPrefix()
legacy = 'two'
enddef
defcompile
let s:legacy = 'one'
END
CheckScriptFailure(lines, 'E476:', 1)
enddef
def Test_var_type_check()
var lines =<< trim END
vim9script
+38
View File
@@ -2102,6 +2102,29 @@ def Test_expr7_funcref()
assert_equal(123, FuncRef())
END
CheckDefAndScriptSuccess(lines)
lines =<< trim END
vim9script
func g:GlobalFunc()
return 'global'
endfunc
func s:ScriptFunc()
return 'script'
endfunc
def Test()
var Ref = g:GlobalFunc
assert_equal('global', Ref())
Ref = GlobalFunc
assert_equal('global', Ref())
Ref = s:ScriptFunc
assert_equal('script', Ref())
Ref = ScriptFunc
assert_equal('script', Ref())
enddef
Test()
END
CheckScriptSuccess(lines)
enddef
let g:test_space_dict = {'': 'empty', ' ': 'space'}
@@ -2714,6 +2737,21 @@ def Test_expr7_negate_add()
CheckDefAndScriptFailure(lines, 'E1050:')
enddef
def Test_expr7_legacy_script()
var lines =<< trim END
let s:legacy = 'legacy'
def GetLocal(): string
return legacy
enddef
def GetLocalPrefix(): string
return s:legacy
enddef
call assert_equal('legacy', GetLocal())
call assert_equal('legacy', GetLocalPrefix())
END
CheckScriptSuccess(lines)
enddef
def Echo(arg: any): string
return arg
enddef
+9
View File
@@ -1263,6 +1263,15 @@ def Test_arg_type_wrong()
CheckScriptFailure(['def Func5(items)', 'echo "a"'], 'E1077:')
enddef
def Test_white_space_before_comma()
var lines =<< trim END
vim9script
def Func(a: number , b: number)
enddef
END
CheckScriptFailure(lines, 'E1068:')
enddef
def Test_white_space_after_comma()
var lines =<< trim END
vim9script
+11
View File
@@ -307,6 +307,17 @@ get_function_args(
emsg(_("E989: Non-default argument follows default argument"));
goto err_ret;
}
if (VIM_ISWHITE(*p) && *skipwhite(p) == ',')
{
// Be tolerant when skipping
if (!skip)
{
semsg(_(e_no_white_space_allowed_before_str_str), ",", p);
goto err_ret;
}
p = skipwhite(p);
}
if (*p == ',')
{
++p;
+26
View File
@@ -765,6 +765,32 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2738,
/**/
2737,
/**/
2736,
/**/
2735,
/**/
2734,
/**/
2733,
/**/
2732,
/**/
2731,
/**/
2730,
/**/
2729,
/**/
2728,
/**/
2727,
/**/
2726,
/**/
2725,
/**/
+29 -33
View File
@@ -332,22 +332,15 @@ script_is_vim9()
/*
* Lookup a variable (without s: prefix) in the current script.
* If "vim9script" is TRUE the script must be Vim9 script. Used for "var"
* without "s:".
* "cctx" is NULL at the script level.
* Returns OK or FAIL.
*/
int
script_var_exists(char_u *name, size_t len, int vim9script, cctx_T *cctx)
static int
script_var_exists(char_u *name, size_t len, cctx_T *cctx)
{
int is_vim9_script;
if (current_sctx.sc_sid <= 0)
return FAIL;
is_vim9_script = script_is_vim9();
if (vim9script && !is_vim9_script)
return FAIL;
if (is_vim9_script)
if (script_is_vim9())
{
// Check script variables that were visible where the function was
// defined.
@@ -382,7 +375,7 @@ variable_exists(char_u *name, size_t len, cctx_T *cctx)
return (cctx != NULL
&& (lookup_local(name, len, NULL, cctx) == OK
|| arg_exists(name, len, NULL, NULL, NULL, cctx) == OK))
|| script_var_exists(name, len, FALSE, cctx) == OK
|| script_var_exists(name, len, cctx) == OK
|| find_imported(name, len, cctx) != NULL;
}
@@ -429,7 +422,7 @@ check_defined(char_u *p, size_t len, cctx_T *cctx, int is_arg)
int c = p[len];
ufunc_T *ufunc = NULL;
if (script_var_exists(p, len, FALSE, cctx) == OK)
if (script_var_exists(p, len, cctx) == OK)
{
if (is_arg)
semsg(_(e_argument_already_declared_in_script_str), p);
@@ -2896,11 +2889,11 @@ compile_load(
if (*(*arg + 1) == ':')
{
// load namespaced variable
if (end <= *arg + 2)
{
isntype_T isn_type;
// load dictionary of namespace
switch (**arg)
{
case 'g': isn_type = ISN_LOADGDICT; break;
@@ -2919,6 +2912,7 @@ compile_load(
{
isntype_T isn_type = ISN_DROP;
// load namespaced variable
name = vim_strnsave(*arg + 2, end - (*arg + 2));
if (name == NULL)
return FAIL;
@@ -2927,11 +2921,21 @@ compile_load(
{
case 'v': res = generate_LOADV(cctx, name, error);
break;
case 's': res = compile_load_scriptvar(cctx, name,
case 's': if (is_expr && ASCII_ISUPPER(*name)
&& find_func(name, FALSE, cctx) != NULL)
res = generate_funcref(cctx, name);
else
res = compile_load_scriptvar(cctx, name,
NULL, &end, error);
break;
case 'g': if (vim_strchr(name, AUTOLOAD_CHAR) == NULL)
isn_type = ISN_LOADG;
{
if (is_expr && ASCII_ISUPPER(*name)
&& find_func(name, FALSE, cctx) != NULL)
res = generate_funcref(cctx, name);
else
isn_type = ISN_LOADG;
}
else
{
isn_type = ISN_LOADAUTO;
@@ -2952,7 +2956,7 @@ compile_load(
{
// Global, Buffer-local, Window-local and Tabpage-local
// variables can be defined later, thus we don't check if it
// exists, give error at runtime.
// exists, give an error at runtime.
res = generate_LOAD(cctx, isn_type, 0, name, &t_any);
}
}
@@ -2990,15 +2994,14 @@ compile_load(
{
// "var" can be script-local even without using "s:" if it
// already exists in a Vim9 script or when it's imported.
if (script_var_exists(*arg, len, TRUE, cctx) == OK
if (script_var_exists(*arg, len, cctx) == OK
|| find_imported(name, 0, cctx) != NULL)
res = compile_load_scriptvar(cctx, name, *arg, &end, FALSE);
// When evaluating an expression and the name starts with an
// uppercase letter or "x:" it can be a user defined function.
// TODO: this is just guessing
if (res == FAIL && is_expr
&& (ASCII_ISUPPER(*name) || name[1] == ':'))
// uppercase letter it can be a user defined function.
// generate_funcref() will fail if the function can't be found.
if (res == FAIL && is_expr && ASCII_ISUPPER(*name))
res = generate_funcref(cctx, name);
}
}
@@ -5708,17 +5711,9 @@ generate_store_var(
return generate_STORE(cctx, ISN_STOREV, vimvaridx, NULL);
case dest_script:
if (scriptvar_idx < 0)
{
char_u *name_s = name;
int r;
// "s:" is included in the name.
r = generate_OLDSCRIPT(cctx, ISN_STORES, name_s,
// "s:" may be included in the name.
return generate_OLDSCRIPT(cctx, ISN_STORES, name,
scriptvar_sid, type);
if (name_s != name)
vim_free(name_s);
return r;
}
return generate_VIM9SCRIPT(cctx, ISN_STORESCRIPT,
scriptvar_sid, scriptvar_idx, type);
case dest_local:
@@ -5852,9 +5847,9 @@ compile_lhs(
&& STRNCMP(var_start, "s:", 2) == 0;
int script_var = (script_namespace
? script_var_exists(var_start + 2, lhs->lhs_varlen - 2,
FALSE, cctx)
cctx)
: script_var_exists(var_start, lhs->lhs_varlen,
TRUE, cctx)) == OK;
cctx)) == OK;
imported_T *import =
find_imported(var_start, lhs->lhs_varlen, cctx);
@@ -6116,6 +6111,7 @@ compile_load_lhs(
{
// this should not happen
emsg(_(e_missbrac));
var_start[varlen] = c;
return FAIL;
}
var_start[varlen] = c;
+1 -2
View File
@@ -2792,12 +2792,11 @@ call_def_function(
else if (ltv->v_type == VAR_STRING)
{
char_u *str = ltv->vval.v_string;
int len = str == NULL ? 0 : (int)STRLEN(str);
// Push the next character from the string. The index
// is for the last byte of the previous character.
++idxtv->vval.v_number;
if (idxtv->vval.v_number >= len)
if (str == NULL || str[idxtv->vval.v_number] == NUL)
{
// past the end of the string, jump to "endfor"
ectx.ec_iidx = iptr->isn_arg.forloop.for_end;