Commit graph

905 commits

Author SHA1 Message Date
Dmytro Maluka
5bfda7b5f6
Merge branch 'master' into fix/file-detection 2024-03-14 04:32:09 +01:00
Dmytro Maluka
00174bb376
Merge pull request #2606 from dmaluka/mouse-release-and-drag-events
Introduce mouse release and mouse drag events
2024-03-14 03:54:04 +01:00
Dmitry Maluka
b824e767d6 Add tab-error and trailingws colors to colorschemes 2024-03-14 03:18:10 +01:00
Dmitry Maluka
c52ccad14b hltrailingws: adjust autoclose plugin implementation
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.
2024-03-14 03:10:33 +01:00
Dmitry Maluka
104caf08dd Highlighting trailing whitespaces
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.
2024-03-14 03:10:31 +01:00
Dmitry Maluka
64370b70d6 Highlighting tab errors
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.
2024-03-14 03:09:30 +01:00
Jöran Karl
ca3a9d0794
command: Add capability to use relative numbers in goto (#2985)
* command: Handle relative line numbers for goto

* help: Adapt goto command documentation
2024-03-13 21:32:12 +01:00
dimaguy
a01ae92541
Add main tag to html syntax highlighting (#2999)
* Add main tag to html syntax highlighting

* Reorder main
2024-03-13 21:12:38 +01:00
Yevhen Babiichuk (DustDFG)
d2ee6107a3
Highlight autcompleted command in statusline for simple theme (#3057)
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
Co-authored-by: Avi Halachmi (:avih) <avihpit@yahoo.com>
2024-03-13 20:44:41 +01:00
toiletbril
69eaa9191a
options: add matchbracestyle (#2876)
* 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>
2024-03-13 20:21:27 +01:00
taconi
14dca7d349
syntax: log: add syntax highlight code for log files (#3105) 2024-03-13 19:01:16 +01:00
taconi
fad4e449fb
syntax: kvlang: add syntax highlight code for .kv files (#3106) 2024-03-13 19:00:29 +01:00
にてん
f0bc6281d4
Add onRune parameter, utf8 package in plugins.md (#3100)
Add bufpane in parameters of onRune, preRune, and unicode/utf8
Go package in plugins.md.
2024-03-12 21:40:13 +01:00
Alex Rønne Petersen
88b4498ce0
Some syntax highlighting updates for C and C#. (#3125)
* 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.
2024-03-12 21:20:03 +01:00
Jöran Karl
3fce03dfd0
syntax: sh: Fix command parameter highlighting (#3128) 2024-03-12 21:11:20 +01:00
Dmytro Maluka
af2ec9d540
Make default fileformat value suited to the OS (#3141)
Set fileformat by default to `dos` on Windows.
2024-03-04 13:20:02 -08:00
Yevhen Babiichuk (DustDFG)
fce8db80de
Add go.mod syntax support (#3061)
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
2024-01-17 00:07:51 -08:00
Jöran Karl
3c16df87ee options: Add capability to define the line count parsed for the signature check 2023-10-26 20:59:42 +02:00
Jöran Karl
2aa386f455 syntax: Prepare a concrete signature example for C++ 2023-10-26 20:59:37 +02:00
Jöran Karl
93151f8109 syntax: Prepare a concrete signature example for objective C 2023-10-26 20:48:27 +02:00
Jöran Karl
433879046e Improve file detection with signature check capabilities
This allows more complex detection upon regex rules for a certain amount of
lines.
2023-10-26 20:20:02 +02:00
Jöran Karl
041ee002dd
syntax: sh: Add here document as string region (#2953) 2023-10-22 00:19:59 +02:00
Jöran Karl
f7244d09c6
Add reload setting - finalization of #2627 (#2845)
* 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>
2023-10-22 00:18:41 +02:00
Andrew Geng
2a9a5afbb2
Fix python decorator syntax. (#2827)
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.
2023-10-16 11:08:37 +02:00
maddes8cht
fe89df1d4e
fix: recognize .cmd as batch files (#2922) 2023-10-16 10:47:44 +02:00
Mikko
9b81589fba
help: fix incorrect instructions for disabling key binding (#2943) 2023-10-16 10:46:01 +02:00
Jöran Karl
1231d24279
syntax: Fix include of patch in git-commit (#2917) 2023-09-14 13:26:51 -07:00
Zachary Yedidia
fbce241753 Docs for fakecursor option
Fixes #2908
2023-09-07 08:17:12 -04:00
taconi
75b9a6cefe
Add onSetActive callback (#2885)
Co-authored-by: taconi <igor.tacoi@protonmail.com>
2023-08-31 17:29:07 +01:00
Jöran Karl
ceaa143c62
highlighter: Fix regions and patterns inside regions (#2840)
* 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
2023-07-11 13:49:12 -07:00
rilysh
cb260bf6bf
add new types for zig (#2861) 2023-07-10 23:11:07 -07:00
Mathias Lohne
0c28fbf7a5
Add support for Jenkinsfile syntax (#2750)
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.
2023-07-08 14:08:34 -07:00
Jan Katins
b02afb1116
Update copypaste.md (#2826)
Status page: https://wezfurlong.org/wezterm/escape-sequences.html#operating-system-command-sequences

Status at 20230521:

> Requests to query the clipboard are ignored. Allows setting or clearing the clipboard

Issue to support querying: https://github.com/wez/wezterm/issues/2050
2023-07-08 14:08:15 -07:00
Jöran Karl
e5bbeff8ac
plugins.md: Add (on|pre)Rune documentation (#2837) 2023-07-08 14:07:56 -07:00
William Etheredge
7e64a43af6
Treat Containerfiles as Dockerfiles (#2846)
Containerfiles should be fully compatible with Dockerfiles:
https://github.com/containers/buildah/discussions/3170
2023-07-08 14:07:19 -07:00
Shreyas A S
51022e6162
Fixed a typo in keybindings.md (#2852)
A 'to' was missing. I noticed it while reading through the documentation.
2023-07-08 14:07:06 -07:00
Christian Muehlhaeuser
ffa7f987b6
Add 'scrollbarchar' option (#2342)
This lets you specify a character that will get used for rendering the
scrollbar.

Co-authored-by: Zachary Yedidia <zyedidia@gmail.com>
2023-07-08 14:02:01 -07:00
Jöran Karl
0859f4aa36
Fix: Syntax highlighting for various issues (#2810)
* 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
2023-06-05 17:39:12 -07:00
Ilya Grigoriev
651a30105b
Goto next/previous diff commands + minor cleanups (#2759)
* 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
2023-04-20 15:23:35 -07:00
Therk
9cef21ecd6
fixed tex comment detection at start of line (#2764) 2023-04-20 15:21:59 -07:00
Arnaud Vallette d'Osia
9c2ce486a5
Hare (harelang) syntax (#2776) 2023-03-16 13:26:33 -07:00
Marcelina Hołub
b16af564a7
refactor(runtime): simplify AssetDir() (#2761)
* refactor(runtime): simplify AssetDir()

* test(runtime): remove cwd checks
2023-02-28 01:31:51 -08:00
Zachary Yedidia
7dd88c2f23 Don't auto-detect commenttype if last_ft is empty
Also fixes commenttype for batch files.

Fixes #2752
2023-02-15 21:57:12 -08:00
Rein F
eb6daab169
Make the commenttype option useful (#2735) 2023-02-05 18:30:12 -08:00
Sertonix
b0cd92b70f
add restrict to C syntax (#2728) 2023-02-04 14:33:25 -08:00
Sertonix
a929437490
fix unsigned int not highlighted (#2725) 2023-02-01 10:27:33 -08:00
Alan Hamlett
0500cc234d
util.HttpRequest helper to make requests with headers (#2678) 2023-01-30 01:29:06 -08:00
Dmitry Maluka
34ac83b594 Introduce mouse release and mouse drag events
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.
2023-01-29 18:21:59 +01:00
Zachary Yedidia
e222ed73b8 Rename multimode to multiopen
Ref #2689
2023-01-24 17:06:52 -08:00
Andrew Geng
432fc7ed58
Add -multimode to open multiple files into split. (#2689)
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.
2023-01-23 11:13:42 -08:00