Fix unwanted highlighting of whitespace in the new line when inserting
a newline after a bracket (when hltrailingws is on). To fix it, change
the order of operations: insert the new empty line after all other
things, to avoid moving the cursor between lines after that.
Added option `hltrailingws` for highlighting trailing whitespaces
at the end of lines. Note that it behaves in a "smart" way.
It doesn't highlight newly added (transient) trailing whitespaces
that naturally occur while typing text. It would be annoying to
see transient highlighting every time we enter a space at the end
of a line while typing.
So a newly added trailing whitespace starts being highlighting
only after the cursor moves to another line. Thus the highlighting
serves its purpose: it draws our attention to annoying sloppy
forgotten trailing whitespaces.
Added option `hltaberrors` which helps to spot sloppy whitespace errors
with tabs used instead of spaces or vice versa.
It uses the value of `tabstospaces` option as a criterion whether a
tab or space character is an error or not.
If `tabstospaces` is on, we probably expect that the file should contain
no tab characters, so any tab character is highlighted as an error.
If `tabstospaces` is off, we probably expect that the file uses
indentation with tabs, so space characters in the initial indent part
of lines are highlighted as errors.
* Update docs to include `matchbracestyle`
* Add `matchbracestyle` to infocomplete.go
* Add validator and default settings for `matchbracestyle`
* Highlight or underline braces based on `matchbracestyle`
* Add `match-brace` to default colorschemes
* Correct `FindMatchingBrace()` counting
Make brace under the cursor have priority over brace to the left in
ambiguous cases when matching braces
Co-authored-by: Dmitry Maluka <dmitrymaluka@gmail.com>
* Fix conflicts
---------
Co-authored-by: Jöran Karl <3951388+JoeKar@users.noreply.github.com>
Co-authored-by: Dmitry Maluka <dmitrymaluka@gmail.com>
* 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.
* Add reload setting
Can be set to:
* auto - Automatically reload files that changed
* disabled - Do not reload files
* prompt - Prompt the user about reloading the file.
* option: Add default value for reload option and documentation
---------
Co-authored-by: Wilberto Morales <wilbertomorales777@gmail.com>
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
* Comment fix & gofmt fix
* Goto next/previous diff commands
These commands will work in `git` repositories or whenever `set diff on` is
working. They are bound to `Alt-[` and `Alt-]` by default. I would prefer
`Alt-Up` and `Alt-Down`, but that's already taken.
There are no tests at the moment; I'm looking into writing some since that will
be needed for the rest of the plan to make
https://github.com/zyedidia/micro/discussions/2753 a reality. I'm not sure how
difficult that will be.
* Realign JSON in keybindings.md
Introduce separate mouse release and mouse drag (move while pressed)
events: MouseLeftRelease, MouseLeftDrag, MouseRightRelease etc,
to allow binding them to actions independently from mouse press events
(MouseLeft, MouseRight etc).
This change:
- Makes it possible to handle mouse release and drag for arbitrary mouse
events and actions (including Lua actions), not just for MouseLeft as
in the current code.
- Fixes issue #2599 with PastePrimary and MouseMultiCursor actions:
selection is pasted not only when pressing MouseMiddle but also when
moving mouse with MouseMiddle pressed; similarly, a new multicursor is
added not only when pressing Ctrl-MouseLeft but also when moving mouse
with Ctrl-MouseLeft pressed.
My initial approach was not to introduce new events for mouse release
and mouse drag but to pass "mouse released" info to action functions
in addition to *tcell.EventMouse to let the action functions do the
necessary checks (similarly to what MousePress is already doing). But
then I realized it was a bad idea, since we still want to be able also
to bind mouse events to regular key actions (such as PastePrimary)
which don't care about mouse event info.
Adds config option `multimode`, which takes values `tab`, `vsplit`,
or `hsplit` (corresponding to the file-opening commands). I mean to
use it with a command line like
micro -multimode vsplit foo.h foo.c
to open files in a side-by-side split, but if one really wanted to
one could set it in the config file to change the default behavior of
opening multiple files in tabs.