Support crontab filetype detection in the case crontab is opened via
sudoedit. Also apparently this fixes crontab filetype detection when
it is opened normally via `crontab -e` but in MacOS.
Fixes#3172
This typo causes a funny bug: the autodetected filetype for *.jsonnet
files is an empty string instead of "jsonnet".
Even funnier, when autocompleting "set filetype " (with the fix from
PR #3218), the first suggested filetype is this empty string.
Turning `header` patterns into `signature` patterns in all syntax files
was a mistake. The two are different things. In almost all syntax files
those patterns are things like shebangs or <?xml ... ?> or
<!DOCTYPE html5> i.e. things that:
1. can be (and should be) used for detecting the filetype when there is
no `filename` match (and that is actually the purpose of those
patterns, so it's a regression that it doesn't work anymore).
2. should only occur in the first line of the file, not in the first
100 lines or so.
In other words, the old `header` semantics was exactly what was needed
for those filetypes, while the new `signature` semantics makes little
sense for them.
So replace `signature` back with `header` in most syntax files. Keep
`signature` only in C++ and Objective-C syntax files, for which it was
actually introduced.
Replacing header patterns with signature patterns was a mistake, since
both have their own uses. So restore support for header regex, while
keeping support for signature regex as well.
* Update C syntax with keywords up to C23.
* Update C syntax with some GCC extensions.
* Update C# syntax with new keywords up to C# 12.
* Update C# syntax with preprocessor directives.
* Add Cake build script (C#) syntax.
* Add MSBuild (XML) syntax.
1. Python decorators begin a compound statement, so they only appear
at the start of a line. So match at the line start to avoid giving
decorator colors to matrix multiplication (@) expressions. Source:
https://docs.python.org/3/reference/compound_stmts.html#function-definitions
2. Python decorators go to the end of the line and might not include
parentheses (for example @functools.cache). So instead of matching
everything until an `(`, just match as many non-`(` characters
as possible---which both catches the @functools.cache example and
allows decorator parameters to fall back to the default color.
3. Instead of hardcoding `brightgreen` (which railscast.micro also
complains about), color decorators as `preproc` (otherwise unused
by the python syntax files, and arguably the right colorscheme
group to be using for syntactic sugars anyway). Note this will
change decorator colors---for example from bright green to kinda
brown on monokai, and from yellow to more of a light orange on
railscast.
* highlighter: Fix regions and patterns inside regions
* highlighting: Remove 2nd recursive highlightRegion() call
...and add limitGroup checks to pattern search.
* yaml: Add TODO type highlighting
* highlighting: Don't stop in highlightRegion() at empty lines
...because possible region line end pattern must be detected.
* syntax/sh: Correct string handling due to additional pattern handling
* syntax/sh: Remove slash in variables
* highlighter: Accept nested region only in case it's within the current reagion
* highlighter: Accept nested patterns only in case it's within the current reagion
* highlighter: Don't search for nesting in case the region end was found at start
Build pipelines for the Jenkins build system are configured in Groovy,
however since their filename is always `Jenkinsfile`, micro doesn't
recognize them as Groovy, and doesn't add syntax highlighting.
This small commit simply adds `Jenkinsfile` and `jenkinsfile` as file
names recognized as Groovy.
* highlighter: Fix region & pattern detection
* syntax/sh: Highlight upper case options too
* syntax/c(pp): Try to synchronize the rules to lower the maintenance effort
* syntax/ruby: Fix explicit filename detection in directories
* highlighter: Respect skip rules in regions
* syntax/sh: Fix parameter expansion, cond. flags and generalize filename via ""
* syntax/php|vi: Correct strings in comments to comments only
Additionally improve vimscript comment handling.
* highlighter: Remove problematic start|end check in find(all)Index()
...and additionally remove recursive region end detection
Specifically, do not allow multiline single-quote strings, which are not a
thing in Julia. The existing rule broke when adjoints were used, such as
`b = a'`.
The syntax rules have been copied from Rust, which also uses single ticks for
character literals, and also uses the ' symbol for things unrelated to chars.