Similar to "sh.vim", there are a handful of other filetypes
whose names (assigned to "b:current_syntax") are different
from the base names of their syntax plugins, e.g. "python2"
and "elsa". Two scripts, "testdir/tools/maketestdeps" and
"testdir/runtest.vim", currently assume that the base name
of a syntax plugin can be derived from the name of a syntax
test. Prescribe using the base name of the syntax plugin,
instead of its filetype, for a test filename prefix so that
existing files are listed in Make targets ("maketestdeps")
and name correspondence is kept between the syntax plugin
and optional test settings for it ("runtest.vim"). Add a CI
check for name verification.
closes: #21414
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Test-case filenames should always begin with the associated
filetype name, properly delimited from the remaining part of
the filename. As of v9.2.0636~1, a convenience function
"DeferRenamingTestFileTo" is provided in "VIM_TEST_SETUP"
aware contexts to temporarily give the file under test
another, arbitrary name before executing ":syntax on".
closes: #21352
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Terminate :global patterns, and :substitute patterns and replacement
text, at EOL. The closing delimiter is optional.
- Clarify the behaviour of optional pattern terminators in the :global
and :substitute help sections.
related: #21132
closes: #21367
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: icalendar files are not recognized
Solution: Detect *.ics files as icalendar filetype, include
syntax and filetype plugins (Anakin Childerhose).
Reference:
https://datatracker.ietf.org/doc/html/rfc5545closes: #21356
Assisted-By: Claude Opus 5
Signed-off-by: Anakin Childerhose <anakin@childerhose.ca>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Whenever two or more filetype names share a common prefix,
e.g. "java" and "javascript", passing the shortest name
argument to Make, e.g. "make java test", will trigger the
running of _all prefix matching_ test suites. To fix this
blunder and to only have _requested_ test suites run, always
append the leftmost conventional delimiters "[._]", e.g.
"java[.]java", "java[_]numbers.java", to each filetype name
when automatically assembling a regexp pattern for the
filename filter. Furthermore, promote the Vim9 (pseudo-)
filetype, e.g. "make vim9 test", "make vim vim9 test", etc.
As before, VIM_SYNTAX_TEST_FILTER is still within reach for
arbitrary test case grouping.
closes: #21351
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Fix matching of the pattern arg in a :syn-sync-match skip command.
closes: #21289
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Contain all matches to a single line.
- Define non-extending groups for the command-line window.
- Replace &buftype-based detection with win_gettype().
closes: #21189
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Link all pattern groups to the new Regexp highlight group
- Highlight delimiters in :syntax command patterns
closes: #21154
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: bazelrc files are not recognized
Solution: Detect *.bazelrc and tools/bazel.rc files as bazelrc filetype,
include syntax und filetype plugins, update the menus
(Barrett Ruth).
closes: #21146
Signed-off-by: Barrett Ruth <br@barrettruth.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Allow Vim9 block terminators after |. While this usage is very unusual
it breaks the block region termination.
E.g., `{| echo "Foo" |}`
closes: #21129
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
As a refinement upon "g:sh_no_error", support not matching
particular classes of syntax errors. Look up syntax rule
names and list them with:
‐-----------------------------------------------------------
let g:sh_no_error_rules = ["shCurlyError", "shParenError"]
‐-----------------------------------------------------------
closes: #20935
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Trailing bar and tail comments are not explicitly supported. The
command is matched to EOL.
- In Vim9 script the following always matches as an assignment:
UserCommand = 2
Use a leading colon to force matching the user command:
:UserCommand = 2
- Add highlighting for utility commands VimFold\a, Vim9, and VimL.
fixes: #20854closes: #21035
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Claim e.g. "function f () { :; }" as shFunctionTwo while
observing that parentheses after the function name are
optional when the "function" word is used and do not delimit
its body if the latter follows them in "{}" (which should
not be taken for granted with limited backtracking).
closes: #20878
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Bash identifiers declared in scripts cannot have a leading
"#" in their names. And neither "namespace" nor "function"
can be followed by a newline before an identifier.
related: #20878
Co-authored-by: Christoffer Aasted <dezzadk@gmail.com>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Variables in make target lists are highlighted as targets when
the prerequisite list is non-empty.
Solution: Match target lists separately from prerequisite regions so
that contained identifiers are highlighted correctly. Add
regression test.
closes: #20947
Signed-off-by: Bogdan Barbu <l4b.bogdan.barbu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Braces in C compound literals and initializers inside parentheses
and brackets are highlighted as errors.
Solution: Recognize those initializer blocks while preserving syntax recovery
for malformed parentheses.
fixes: #18709closes: #20842
Signed-off-by: Bogdan Barbu <l4b.bogdan.barbu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Vim Syntax Script can be improved
Solution: Rework syntax script, update syntax tests and unit tests
(Doug Kearns).
- Contain Ex commands to valid syntactic contexts.
- Add full address (:range) matching.
- Match :Next, :Print, :X, :global, :&, :~, :>, :<, :# and := commands.
- Match text input commands with folding.
Use :syn-keyword to match all commands except when immediately following
\w range characters where :syn-match is employed.
fixes: #20250 (variables with s_ prefix are wrongly highlighted)
fixes: #17543 (do not highlight vim commands within :runtime)
fixes: #16937 (do not highlight vim commands after packadd)
fixes: #14895 (incorrect highlighting of Vim syntax)
fixes: #14020 (insert commands)
closes: #19331
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: filetype: ed script files not recognised.
Solution: Add filetype detection for *.ed files and shebang lines,
include syntax script and syntax tests.
Features of the ed syntax file:
- BSD and GNU extensions are supported
- Andrew L. Moore's ed extensions are not supported
- Rebuild synmenu.vim
closes: #19602
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Lazy imports (PEP 810, to be released in Python 3.15) introduces a
`lazy` soft keyword that's recognized when it precedes a `from` or
`import` keyword.
closes: #20342
Signed-off-by: Jon Parise <jon@indelible.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: s:SearchBracket()'s skip-expression matches syntax group
names ending in "Comment", "Todo", or "String" to decide
whether a candidate bracket is inside a string/comment
and should be skipped for indentation purposes. Byte and
raw-byte string literals (b"...", rb"...") are highlighted
via the pythonBytes/pythonRawBytes syntax groups, which
don't end in "String", so brackets inside them (e.g.
b"[") were never skipped and were counted as real,
unmatched brackets, producing incorrect indentation.
Solution: Add "Bytes" to the indent script's existing suffix match,
so pythonBytes/pythonRawBytes are recognized directly, the
same way pythonString/pythonFString/pythonRawString
already are.
This supersedes an earlier version of this fix that
renamed pythonBytes/pythonRawBytes to
pythonBytesString/pythonRawBytesString in
runtime/syntax/python.vim.
fixes: #20812closes: #20827
Signed-off-by: qwavies <qwavsbusiness@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: diff highlighting hard to read with syntax enabled and
terminals having 256 or less colors (Andrey Butirsky)
Solution: Set a cterm foreground color (Maxim Kim)
fixes: #4071closes: #20711
Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
* Match command names introduced in v.5.0.0 (August 2024):
"auth", "multiinput", "status", "truecolor".
* Match command names introduced in v.4.5.0 (January 2017):
"defdynamictitle" and "dynamictitle".
* Deprecate command names that have been retired thus far:
"debug", "maxwin", "nethack", "password", "time".
* Remove a spurious "defzombie" command name (this name is
just lamented over in the documentation entry for the
"zombie" command as being more fitting than "zombie"
because its effects are not local to a window; no such
name is entered in "comm.c").
* Separately group the Braille navigation commands, "bd_*",
that may belong to another, superset program Dotscreen:
(see doc/README.DOTSCREEN and commit 848af83f5 elsewhere).
* Revise string escape characters:
- Recognise more characters, "%[`<>=eEfFHOPSxX]".
- Recognise undocumented characters, "%[gNpT]", and list
relevant Screen commits in the comments.
- Match optional qualifiers, "%\%([-+L]\|\d\+\).".
* Match more items in double-quoted command arguments.
* Match unquoted environment variable references.
* Match octal numbers, e.g. "defmode 0622".
* Match escaped octal numbers, e.g. "bind \077 help".
Unless a Dotscreen program (c. 1995) or an older than
v.4.3.1 (c. 2015) Screen program, that was compiled with
"HAVE_BRAILLE" defined, is installed and needs configuring,
add to ".vim/after/syntax/screen.vim":
-----------------------------------------------------------
if hlexists('dotscreenCommands')
syn clear dotscreenCommands
endif
-----------------------------------------------------------
To BACKPORT the updated syntax file to version 4 of Screen,
add to ".vim/after/syntax/screen.vim":
-----------------------------------------------------------
if hlexists('screenDeprecatedCommands')
syn clear screenDeprecatedCommands
endif
if hlexists('screenVersion5Commands')
syn clear screenVersion5Commands
endif
-----------------------------------------------------------
References:
https://lists.gnu.org/archive/html/info-gnu/2024-08/msg00004.htmlhttps://lists.gnu.org/archive/html/info-gnu/2017-01/msg00007.htmlhttps://git.savannah.gnu.org/git/screen.gitcloses: #20550
Co-authored-by: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Add a guarded "C++ 26 extensions" block (cpp_no_cpp26) covering new
lexical surface introduced since C++23:
- [[ ... ]] attributes as a region, so P3394 annotations carrying a
value expression (eg [[=foo{1}]]) no longer trip cErrInBracket on
their braces/parens. A \w\@1<! look-behind keeps it from matching a
subscripted immediately-invoked lambda (arr[[]{...}()]).
- ^^ reflection operator (P2996).
- [: :] splice brackets (P2996).
- contract_assert keyword (P2900).
Add input/cpp_cpp26.cpp exercising these constructs with screendumps,
and update dumps/cpp_noreturn_00.dump for the new [[ ]] attribute
delimiter highlighting.
closes: #20577
Signed-off-by: Gareth Lloyd <gareth@ignition-web.co.uk>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Explicitly match the LONG/SHORT size prefixes in integral, real and bits
denotations.
LONG/SHORT are matched as part of the denotation rather than as a mode.
closes: #20512
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
The current scheme for naming syntax plugin tests expects
a filetype name prefix and an associated filename extension.
However, many configurational filetypes, e.g. Gitignore,
lack any established filename extension. Factor out the
available file-renaming routine and offer a convenience
function to work around this limitation.
For example, put in a VIM_TEST_SETUP aware context:
------------------------------------------------------------
call DeferRenamingTestFileTo('.gitignore')
------------------------------------------------------------
closes: #20482
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Explicitly match the dot accessor
- Exclude the qualifier when matching qualified function calls
The dot accessor lookbehind on builtin function calls was slow, matching
across expression based dictionary accessors was visually inconsistent,
and it's arguably more semantically correct.
closes: #20481
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
- Remove `g:algol68_symbolic_operators` config variable, these operators
are now always highlighted along with bold word operators
- Remove GSL `/-` operator, this was a typo in the implementation and
now fixed in the latest Genie release as `/=`
closes: #20195
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Anchor the return type separator ':' with a lookbehind as the relevant
nextgroup options use skipwhite.
closes: #20319
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>