summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/builtin.txt50
-rw-r--r--runtime/doc/index.txt4
-rw-r--r--runtime/doc/syntax.txt6
-rw-r--r--runtime/doc/todo.txt5
-rw-r--r--runtime/doc/usr_41.txt6
-rw-r--r--runtime/doc/vim9.txt10
-rw-r--r--runtime/import/dist/vimhelp.vim34
-rw-r--r--runtime/syntax/m4.vim3
-rw-r--r--runtime/syntax/sh.vim46
-rw-r--r--runtime/syntax/vim.vim10
10 files changed, 120 insertions, 54 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index e24bac80a..b2e276e5c 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -5107,7 +5107,7 @@ len({expr}) The result is a Number, which is the length of the argument.
When {expr} is a |Blob| the number of bytes is returned.
When {expr} is a |Dictionary| the number of entries in the
|Dictionary| is returned.
- Otherwise an error is given.
+ Otherwise an error is given and returns zero.
Can also be used as a |method|: >
mylist->len()
@@ -5200,6 +5200,7 @@ line({expr} [, {winid}]) *line()*
|getpos()|.
With the optional {winid} argument the values are obtained for
that window instead of the current window.
+ Returns 0 for invalid values of {expr} and {winid}.
Examples: >
line(".") line number of the cursor
line(".", winid) idem, in window "winid"
@@ -5267,6 +5268,8 @@ list2str({list} [, {utf8}]) *list2str()*
With UTF-8 composing characters work as expected: >
list2str([97, 769]) returns "á"
<
+ Returns an empty string on error.
+
Can also be used as a |method|: >
GetList()->list2str()
@@ -5339,6 +5342,8 @@ listener_add({callback} [, {buf}]) *listener_add()*
The {callback} is also not invoked when the buffer is
unloaded, use the |BufUnload| autocmd event for that.
+ Returns zero if {callback} or {buf} is invalid.
+
Can also be used as a |method|, the base is passed as the
second argument: >
GetBuffer()->listener_add(callback)
@@ -5371,6 +5376,7 @@ log({expr}) *log()*
Return the natural logarithm (base e) of {expr} as a |Float|.
{expr} must evaluate to a |Float| or a |Number| in the range
(0, inf].
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
Examples: >
:echo log(10)
< 2.302585 >
@@ -5386,6 +5392,7 @@ log({expr}) *log()*
log10({expr}) *log10()*
Return the logarithm of Float {expr} to base 10 as a |Float|.
{expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
Examples: >
:echo log10(1000)
< 3.0 >
@@ -5484,8 +5491,9 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()*
below. To get a list of all mappings see |maplist()|.
When there is no mapping for {name}, an empty String is
- returned. When the mapping for {name} is empty, then "<Nop>"
- is returned.
+ returned if {dict} is FALSE, otherwise returns an empty Dict.
+ When the mapping for {name} is empty, then "<Nop>" is
+ returned.
The {name} can have special key names, like in the ":map"
command.
@@ -5778,6 +5786,8 @@ matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]])
The number of matches is not limited, as it is the case with
the |:match| commands.
+ Returns -1 on error.
+
Example: >
:highlight MyGroup ctermbg=green guibg=green
:let m = matchadd("MyGroup", "TODO")
@@ -5816,6 +5826,8 @@ matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]])
The maximum number of positions in {pos} is 8.
+ Returns -1 on error.
+
Example: >
:highlight MyGroup ctermbg=green guibg=green
:let m = matchaddpos("MyGroup", [[23, 24], 34])
@@ -6285,6 +6297,7 @@ pathshorten({path} [, {len}]) *pathshorten()*
:echo pathshorten('~/.vim/autoload/myfile.vim', 2)
< ~/.vi/au/myfile.vim ~
It doesn't matter if the path exists or not.
+ Returns an empty string on error.
Can also be used as a |method|: >
GetDirectories()->pathshorten()
@@ -6314,6 +6327,7 @@ popup_ functions are documented here: |popup-functions|
pow({x}, {y}) *pow()*
Return the power of {x} to the exponent {y} as a |Float|.
{x} and {y} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {x} or {y} is not a |Float| or a |Number|.
Examples: >
:echo pow(3, 3)
< 27.0 >
@@ -6690,6 +6704,7 @@ rand([{expr}]) *rand()* *random*
{expr} can be initialized by |srand()| and will be updated by
rand(). If {expr} is omitted, an internal seed value is used
and updated.
+ Returns -1 if {expr} is invalid.
Examples: >
:echo rand()
@@ -6779,6 +6794,8 @@ readdir({directory} [, {expr} [, {dict}]]) *readdir()*
endfunction
echo s:tree(".")
<
+ Returns an empty List on error.
+
Can also be used as a |method|: >
GetDirName()->readdir()
<
@@ -6837,7 +6854,6 @@ readdirex({directory} [, {expr} [, {dict}]]) *readdirex()*
For example, to get a list of all files in the current
directory without sorting the individual entries: >
readdirex(dirname, '1', #{sort: 'none'})
-
<
Can also be used as a |method|: >
GetDirName()->readdirex()
@@ -6927,8 +6943,8 @@ reltime([{start} [, {end}]]) *reltime()*
and {end}.
The {start} and {end} arguments must be values returned by
- reltime(). If there is an error zero is returned in legacy
- script, in Vim9 script an error is given.
+ reltime(). If there is an error an empty List is returned in
+ legacy script, in Vim9 script an error is given.
Can also be used as a |method|: >
GetStart()->reltime()
@@ -7047,7 +7063,8 @@ remote_peek({serverid} [, {retvar}]) *remote_peek()*
remote_read({serverid}, [{timeout}]) *remote_read()*
Return the oldest available reply from {serverid} and consume
it. Unless a {timeout} in seconds is given, it blocks until a
- reply is available.
+ reply is available. Returns an empty string, if a reply is
+ not available or on error.
See also |clientserver|.
This function is not available in the |sandbox|.
{only available when compiled with the |+clientserver| feature}
@@ -7106,6 +7123,7 @@ remove({list}, {idx} [, {end}]) *remove()*
item as {end} a list with one item is returned. When {end}
points to an item before {idx} this is an error.
See |list-index| for possible values of {idx} and {end}.
+ Returns zero on error.
Example: >
:echo "last item: " .. remove(mylist, -1)
:call remove(mylist, 0, 9)
@@ -7122,6 +7140,7 @@ remove({blob}, {idx} [, {end}])
return a |Blob| with these bytes. When {idx} points to the same
byte as {end} a |Blob| with one byte is returned. When {end}
points to a byte before {idx} this is an error.
+ Returns zero on error.
Example: >
:echo "last byte: " .. remove(myblob, -1)
:call remove(mylist, 0, 9)
@@ -7131,6 +7150,7 @@ remove({dict}, {key})
Example: >
:echo "removed " .. remove(dict, "one")
< If there is no {key} in {dict} this is an error.
+ Returns zero on error.
rename({from}, {to}) *rename()*
Rename the file by the name {from} to the name {to}. This
@@ -7179,6 +7199,7 @@ reverse({object}) *reverse()*
Reverse the order of items in {object} in-place.
{object} can be a |List| or a |Blob|.
Returns {object}.
+ Returns zero if {object} is not a List or a Blob.
If you want an object to remain unmodified make a copy first: >
:let revlist = reverse(copy(mylist))
< Can also be used as a |method|: >
@@ -7189,6 +7210,7 @@ round({expr}) *round()*
as a |Float|. If {expr} lies halfway between two integral
values, then use the larger one (away from zero).
{expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
Examples: >
echo round(0.456)
< 0.0 >
@@ -7223,6 +7245,7 @@ screenattr({row}, {col}) *screenattr()*
Like |screenchar()|, but return the attribute. This is a rather
arbitrary number that can only be used to compare to the
attribute at other positions.
+ Returns -1 when row or col is out of range.
Can also be used as a |method|: >
GetRow()->screenattr(col)
@@ -7286,6 +7309,7 @@ screenpos({winid}, {lnum}, {col}) *screenpos()*
|conceal| taken into account.
If the position is in a closed fold the screen position of the
first character is returned, {col} is not used.
+ Returns an empty Dict if {winid} is invalid.
Can also be used as a |method|: >
GetWinid()->screenpos(lnum, col)
@@ -8346,6 +8370,7 @@ simplify({filename}) *simplify()*
sin({expr}) *sin()*
Return the sine of {expr}, measured in radians, as a |Float|.
{expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
Examples: >
:echo sin(100)
< -0.506366 >
@@ -8362,6 +8387,7 @@ sinh({expr}) *sinh()*
Return the hyperbolic sine of {expr} as a |Float| in the range
[-inf, inf].
{expr} must evaluate to a |Float| or a |Number|.
+ Returns 0.0 if {expr} is not a |Float| or a |Number|.
Examples: >
:echo sinh(0.5)
< 0.521095 >
@@ -8381,6 +8407,7 @@ slice({expr}, {start} [, {end}]) *slice()*
|vim9script|. Also, composing characters are not counted.
When {end} is omitted the slice continues to the last item.
When {end} is -1 the last item is omitted.
+ Returns an empty value if {start} or {end} are invalid.
Can also be used as a |method|: >
GetList()->slice(offset)
@@ -8626,7 +8653,8 @@ sqrt({expr}) *sqrt()*
Return the non-negative square root of Float {expr} as a
|Float|.
{expr} must evaluate to a |Float| or a |Number|. When {expr}
- is negative the result is NaN (Not a Number).
+ is negative the result is NaN (Not a Number). Returns 0.0 if
+ {expr} is not a |Float| or a |Number|.
Examples: >
:echo sqrt(100)
< 10.0 >
@@ -8707,6 +8735,8 @@ str2float({string} [, {quoted}]) *str2float()*
|substitute()|: >
let f = str2float(substitute(text, ',', '', 'g'))
<
+ Returns 0.0 if the conversion fails.
+
Can also be used as a |method|: >
let f = text->substitute(',', '', 'g')->str2float()
<
@@ -8746,6 +8776,8 @@ str2nr({string} [, {base} [, {quoted}]]) *str2nr()*
{base} is 2 a leading "0b" or "0B" is ignored.
Text after the number is silently ignored.
+ Returns 0 if {string} is empty or on error.
+
Can also be used as a |method|: >
GetText()->str2nr()
@@ -8756,6 +8788,8 @@ strcharlen({string}) *strcharlen()*
|strchars()| can count the number of characters, counting
composing characters separately.
+ Returns 0 if {string} is empty or on error.
+
Also see |strlen()|, |strdisplaywidth()| and |strwidth()|.
Can also be used as a |method|: >
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 190ce7c55..8be4c627a 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt* For Vim version 8.2. Last change: 2022 Mar 05
+*index.txt* For Vim version 8.2. Last change: 2022 Jun 11
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -295,7 +295,7 @@ tag char note action in Normal mode ~
|/| /{pattern}<CR> 1 search forward for the Nth occurrence of
{pattern}
|/<CR>| /<CR> 1 search forward for {pattern} of last search
-|count| 0 1 cursor to the first char of the line
+|0| 0 1 cursor to the first char of the line
|count| 1 prepend to command to give a count
|count| 2 "
|count| 3 "
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 38a4a1c78..e75f87060 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt* For Vim version 8.2. Last change: 2022 Jun 03
+*syntax.txt* For Vim version 8.2. Last change: 2022 Jun 10
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5395,8 +5395,8 @@ StatusLineNC status lines of not-current windows
*hl-StatusLineTerm*
StatusLineTerm Status line of current window, if it is a |terminal| window.
*hl-StatusLineTermNC*
-StatusLineTermNC Status lines of not-current windows that is a |terminal|
- window.
+StatusLineTermNC Status lines of not-current windows that is a
+ |terminal| window.
*hl-TabLine*
TabLine Tab pages line, not active tab page label.
*hl-TabLineFill*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index bd86b20cb..d880553c4 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 8.2. Last change: 2022 Jun 09
+*todo.txt* For Vim version 8.2. Last change: 2022 Jun 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -38,6 +38,9 @@ browser use: https://github.com/vim/vim/issues/1234
*known-bugs*
-------------------- Known bugs and current work -----------------------
+searchpair() must call function to set timeout, not pass the time limit down
+(and set it many times). #10562
+
Prepare for Vim 9.0 release:
- Update the user manual:
- Add more to usr_50.txt as an "advanced section" of usr_41.txt
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index ba3cd2eda..e2dc46365 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1,4 +1,4 @@
-*usr_41.txt* For Vim version 8.2. Last change: 2022 Jun 04
+*usr_41.txt* For Vim version 8.2. Last change: 2022 Jun 10
VIM USER MANUAL - by Bram Moolenaar
@@ -1509,7 +1509,7 @@ functions: >
function SetSyn(name) ~
The "<SNR>" prefix means that a function is script-local. |Vim9| functions
-wil start with "def" and include argument and return types. Legacy functions
+will start with "def" and include argument and return types. Legacy functions
are listed with "function".
To see what a function does, use its name as an argument for `function`: >
@@ -1667,7 +1667,7 @@ Notice that the first item of the List that range() produces is zero, thus the
last item is one less than the length of the list. Detail: Internally range()
does not actually create the list, so that a large range used in a for loop
works efficiently. When used elsewhere, the range is turned into an actual
-list, which takes more time for a long ist.
+list, which takes more time for a long list.
You can also specify the maximum value, the stride and even go backwards: >
diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt
index 9cd90d5be..9b7c8dce1 100644
--- a/runtime/doc/vim9.txt
+++ b/runtime/doc/vim9.txt
@@ -1,4 +1,4 @@
-*vim9.txt* For Vim version 8.2. Last change: 2022 May 21
+*vim9.txt* For Vim version 8.2. Last change: 2022 Jun 10
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1612,7 +1612,7 @@ and cannot be accessed by the importing script.
This mechanism exists for writing a script that can be sourced (imported) by
other scripts, while making sure these other scripts only have access to what
you want them to. This also avoids using the global namespace, which has a
-risc of name collisions. For example when you have two plugins with similar
+risk of name collisions. For example when you have two plugins with similar
functionality.
You can cheat by using the global namespace explicitly. That should be done
@@ -1758,7 +1758,9 @@ used: >
When the mapping is defined "<SID>name." will be replaced with <SNR> and the
script ID of the imported script.
-
+An even simpler solution is using |<ScriptCmd>|: >
+ noremap ,a <ScriptCmd>name.Function()<CR>
+<
*:import-cycle*
The `import` commands are executed when encountered. If script A imports
script B, and B (directly or indirectly) imports A, this will be skipped over.
@@ -2202,7 +2204,7 @@ dictionary. With some care this can be made to work, but it does not look
like real classes. On top of that, it's quite slow, because of the use of
dictionaries.
-It would be good to support real classes, and this is planned for a leter
+It would be good to support real classes, and this is planned for a later
version. The support is a "minimal common functionality" of class support in
most languages. It will work much like Java, which is the most popular
programming language.
diff --git a/runtime/import/dist/vimhelp.vim b/runtime/import/dist/vimhelp.vim
index e0afd1f97..d053f6304 100644
--- a/runtime/import/dist/vimhelp.vim
+++ b/runtime/import/dist/vimhelp.vim
@@ -4,24 +4,28 @@ vim9script
# Called when editing the doc/syntax.txt file
export def HighlightGroups()
+ var save_cursor = getcurpos()
var buf: number = bufnr('%')
- var lnum: number = search('\*highlight-groups\*', 'cn')
- while getline(lnum) !~ '===' && lnum < line('$')
- var word: string = getline(lnum)->matchstr('^\w\+\ze\s')
+
+ var start: number = search('\*highlight-groups\*', 'c')
+ var end: number = search('^======')
+ for lnum in range(start, end)
+ var word: string = getline(lnum)->matchstr('^\w\+\ze\t')
if word->hlexists()
- var name = 'help-hl-' .. word
- if prop_type_list({bufnr: buf})->match(name) == -1
- prop_type_add('help-hl-' .. word, {
- bufnr: buf,
- highlight: word,
- combine: false,
- })
- else
+ var type = 'help-hl-' .. word
+ if prop_type_list({bufnr: buf})->index(type) != -1
# was called before, delete existing properties
- prop_remove({type: name, bufnr: buf})
+ prop_remove({type: type, bufnr: buf})
+ prop_type_delete(type, {bufnr: buf})
endif
- prop_add(lnum, 1, {length: word->strlen(), type: 'help-hl-' .. word})
+ prop_type_add(type, {
+ bufnr: buf,
+ highlight: word,
+ combine: false,
+ })
+ prop_add(lnum, 1, {length: word->strlen(), type: type})
endif
- ++lnum
- endwhile
+ endfor
+
+ setpos('.', save_cursor)
enddef
diff --git a/runtime/syntax/m4.vim b/runtime/syntax/m4.vim
index 366f65890..f90197aeb 100644
--- a/runtime/syntax/m4.vim
+++ b/runtime/syntax/m4.vim
@@ -2,7 +2,8 @@
" Language: M4
" Maintainer: Claudio Fleiner (claudio@fleiner.com)
" URL: http://www.fleiner.com/vim/syntax/m4.vim
-" Last Change: 2005 Jan 15
+" (outdated)
+" Last Change: 2022 Jun 12
" This file will highlight user function calls if they use only
" capital letters and have at least one argument (i.e. the '('
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index 731a514cb..a0ff49907 100644
--- a/runtime/syntax/sh.vim
+++ b/runtime/syntax/sh.vim
@@ -2,8 +2,8 @@
" Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
-" Last Change: Oct 26, 2021
-" Version: 199
+" Last Change: Jun 09, 2022
+" Version: 201
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) and heredoc fixes from Felipe Contreras
@@ -138,7 +138,7 @@ syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsa
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster ErrorList add=shDTestError
endif
-syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor,shFunctionKey,shFunctionOne,shFunctionTwo
+syn cluster shArithParenList contains=shArithmetic,shArithParen,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shHereString,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shArithList contains=@shArithParenList,shParenError
syn cluster shCaseEsacList contains=shCaseStart,shCaseLabel,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange
syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shCommandSubBQ,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
@@ -147,8 +147,8 @@ if exists("b:is_kornshell") || exists("b:is_bash")
endif
syn cluster shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable
syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
-" COMBAK: removing shEscape from shDblQuoteList fails ksh04:43
-syn cluster shDblQuoteList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shPosnParm,shCtrlSeq,shSpecial,shSpecialDQ
+" COMBAK: removing shEscape from shDblQuoteList fails ksh04:43 -- Jun 09, 2022: I don't see the problem with ksh04, so am reinstating shEscape
+syn cluster shDblQuoteList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial,shSpecialDQ
syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS
syn cluster shDerefVarList contains=shDerefOffset,shDerefOp,shDerefVarArray,shDerefOpError
syn cluster shEchoList contains=shArithmetic,shCommandSub,shCommandSubBQ,shDeref,shDerefSimple,shEscape,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq,shEchoQuote
@@ -157,11 +157,12 @@ syn cluster shExprList2 contains=@shExprList1,@shCaseList,shTest
syn cluster shFunctionList contains=@shCommandSubList,shCaseEsac,shColon,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shOption,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shCtrlSeq
if exists("b:is_kornshell") || exists("b:is_bash")
syn cluster shFunctionList add=shRepeat,shDblBrace,shDblParen,shForPP
+ syn cluster shDerefList add=shCommandSubList,shEchoDeref
endif
syn cluster shHereBeginList contains=@shCommandSubList
syn cluster shHereList contains=shBeginHere,shHerePayload
syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
-syn cluster shIdList contains=shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
+syn cluster shIdList contains=shArithmetic,shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shIf,shOption,shSet,shTest,shTestOpr,shTouch
if exists("b:is_kornshell") || exists("b:is_bash")
@@ -179,6 +180,10 @@ syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shComman
" This one is needed INSIDE a CommandSub, so that `echo bla` be correct
syn region shEcho matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
syn region shEcho matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" matchgroup=NONE end="[<>;&|()`]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
+if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
+ syn region shEchoDeref contained matchgroup=shStatement start="\<echo\>" skip="\\$" matchgroup=shEchoDelim end="$" end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
+ syn region shEchoDeref contained matchgroup=shStatement start="\<print\>" skip="\\$" matchgroup=shEchoDelim end="$" end="[<>;&|()`}]"me=e-1 end="\d[<>]"me=e-2 end="#"me=e-1 contains=@shEchoList skipwhite nextgroup=shQuickComment
+endif
syn match shEchoQuote contained '\%(\\\\\)*\\["`'()]'
" This must be after the strings, so that ... \" will be correct
@@ -291,13 +296,15 @@ syn match shCaseStart contained skipwhite skipnl "(" nextgroup=shCase,shCaseBa
syn match shCaseLabel contained skipwhite "\%(\\.\|[-a-zA-Z0-9_*.]\)\+" contains=shCharClass
if exists("b:is_bash")
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end=";&" end=";;&" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
+elseif exists("b:is_kornshell")
+ ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end=";&" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
else
ShFoldIfDoFor syn region shCase contained skipwhite skipnl matchgroup=shSnglCase start="\%(\\.\|[^#$()'" \t]\)\{-}\zs)" end=";;" end="esac"me=s-1 contains=@shCaseList nextgroup=shCaseStart,shCase,shComment
endif
ShFoldIfDoFor syn region shCaseEsac matchgroup=shConditional start="\<case\>" end="\<esac\>" contains=@shCaseEsacList
syn keyword shCaseIn contained skipwhite skipnl in nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
-if exists("b:is_bash")
+if exists("b:is_bash") || exists("b:is_kornshell")
syn region shCaseExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial skipwhite skipnl nextgroup=shCaseBar contained
elseif !exists("g:sh_no_error")
syn region shCaseExSingleQuote matchgroup=Error start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial skipwhite skipnl nextgroup=shCaseBar contained
@@ -329,10 +336,11 @@ syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment
" systems too, however, so the following syntax will flag $(..) as
" an Error under /bin/sh. By consensus of vimdev'ers!
if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix")
- syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
+ syn region shCommandSub matchgroup=shCmdSubRegion start="\$(\ze[^(]" skip='\\\\\|\\.' end=")" contains=@shCommandSubList
syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList
syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList
syn match shSkipInitWS contained "^\s\+"
+ syn region shArithParen matchgroup=shArithRegion contained start="(" end=")" contains=@shArithParenList
elseif !exists("g:sh_no_error")
syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList
endif
@@ -368,7 +376,7 @@ endif
syn match shNumber "\<\d\+\>#\="
syn match shNumber "\<-\=\.\=\d\+\>#\="
syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained
-if exists("b:is_bash")
+if exists("b:is_bash") || exists("b:is_kornshell")
syn match shSpecial "[^\\]\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
syn match shSpecial "^\(\\\\\)*\zs\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
syn region shExSingleQuote matchgroup=shQuote start=+\$'+ skip=+\\\\\|\\.+ end=+'+ contains=shStringSpecial,shSpecial nextgroup=shSpecialNxt
@@ -441,19 +449,24 @@ syn match shVar contained "\h\w*"
syn region shAtExpr contained start="@(" end=")" contains=@shIdList
if exists("b:is_bash")
syn match shSet "^\s*set\ze\s\+$"
- syn region shSetList oneline matchgroup=shSet start="\<\%(declare\|local\|export\)\>\ze[/a-zA-Z_]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList
+ syn region shSetList oneline matchgroup=shSet start="\<\%(declare\|local\|export\)\>\ze[/a-zA-Z_]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList
syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\)\>[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList nextgroup=shComment
elseif exists("b:is_kornshell") || exists("b:is_posix")
syn match shSet "^\s*set\ze\s\+$"
if exists("b:is_dash")
- syn region shSetList oneline matchgroup=shSet start="\<\%(local\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
+ syn region shSetList oneline matchgroup=shSet start="\<\%(local\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
endif
- syn region shSetList oneline matchgroup=shSet start="\<\(export\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
+ syn region shSetList oneline matchgroup=shSet start="\<\(export\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\>\)\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList nextgroup=shComment
else
syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList
endif
+" KornShell namespace: {{{1
+if exists("b:is_kornshell")
+ syn keyword shFunctionKey namespace skipwhite skipnl nextgroup=shFunctionTwo
+endif
+
" Functions: {{{1
if !exists("b:is_posix")
syn keyword shFunctionKey function skipwhite skipnl nextgroup=shFunctionTwo
@@ -473,7 +486,7 @@ endif
" Parameter Dereferencing: {{{1
" ========================
-if !exists("g:sh_no_error")
+if !exists("g:sh_no_error") && !(exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix"))
syn match shDerefWordError "[^}$[~]" contained
endif
syn match shDerefSimple "\$\%(\h\w*\|\d\)" nextgroup=@shNoZSList
@@ -486,6 +499,13 @@ if exists("b:is_bash") || exists("b:is_kornshell") || exists("b:is_posix")
syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS,shSpecialStart
endif
+" ksh: ${.sh.*} variables: {{{1
+" ========================================
+if exists("b:is_kornshell")
+" syn match shDerefVar contained "[.]*" nextgroup=@shDerefVarList
+ syn match shDerefVar contained "\.\+" nextgroup=@shDerefVarList
+endif
+
" ksh: ${!var[*]} array index list syntax: {{{1
" ========================================
if exists("b:is_kornshell") || exists("b:is_posix")
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index af3c2e4b1..304fdb083 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Vim 8.2 script
" Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
-" Last Change: May 27, 2022
-" Version: 8.2-42
+" Last Change: Jun 12, 2022
+" Version: 8.2-43
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM
" Automatically generated keyword lists: {{{1
@@ -328,7 +328,7 @@ syn match vimPatSep contained "\\|"
syn region vimPatSepZone oneline contained matchgroup=vimPatSepZ start="\\%\=\ze(" skip="\\\\" end="\\)\|[^\\]['"]" contains=@vimStringGroup
syn region vimPatRegion contained transparent matchgroup=vimPatSepR start="\\[z%]\=(" end="\\)" contains=@vimSubstList oneline
syn match vimNotPatSep contained "\\\\"
-syn cluster vimStringGroup contains=vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell
+syn cluster vimStringGroup contains=vimEscape,vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell
syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ matchgroup=vimStringEnd end=+"+ contains=@vimStringGroup
syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]'+lc=1 end=+'+
syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup
@@ -336,6 +336,7 @@ syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@v
"syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup " see tst45.vim
syn match vimString contained +"[^"]*\\$+ skipnl nextgroup=vimStringCont
syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+
+syn match vimEscape contained "\\."
" Substitutions: {{{2
" =============
@@ -465,7 +466,7 @@ syn case match
" User Function Highlighting: {{{2
" (following Gautam Iyer's suggestion)
" ==========================
-syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimCommand,vimFuncEcho,vimFuncName,vimUserFunc,vimExecute
+syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncEcho,vimFuncName,vimUserFunc,vimExecute
syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimCommand,vimNotation
syn keyword vimFuncEcho contained ec ech echo
@@ -897,6 +898,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimElseif vimCondHL
hi def link vimEnvvar PreProc
hi def link vimError Error
+ hi def link vimEscape Special
hi def link vimFBVar vimVar
hi def link vimFgBgAttrib vimHiAttrib
hi def link vimFuncEcho vimCommand