* plugins: Parse repo.json only, not every json file
According to the documentation, micro reads plugin info from the
`repo.json` file in the plugin's directory. In reality, micro reads
plugin info from each and every `*.json` file in the plugin's directory,
not only from `repo.json` (so if there are multiple json files, each
next one overrides info read from the previous one). Fix this absurdity.
* plugins: Don't parse repo.json for built-in plugins
Built-in plugins don't have repo.json and never will, there is no point
in checking if they have one, this only results in code duplication and
dead code.
Built-in plugins don't have repo.json and never will, there is no point
in checking if they have one, this only results in code duplication and
dead code.
According to the documentation, micro reads plugin info from the
`repo.json` file in the plugin's directory. In reality, micro reads
plugin info from each and every `*.json` file in the plugin's directory,
not only from `repo.json` (so if there are multiple json files, each
next one overrides info read from the previous one). Fix this absurdity.
A .json file in a plugin directory that decodes to an empty list (`[]`
or `null`) made NewPluginInfo index info[0] on an empty slice. The panic
happens in InitPlugins(), before the recover() in main(), and the
deferred exit(0) ends micro silently with status 0 on every start.
A file whose first entry has no Name did not crash, but it replaced the
plugin name with an empty string, so the plugin was dropped as "not a
plugin".
Return the existing ErrMissingName in both cases. InitPlugins() already
skips files that fail to parse, so the plugin keeps its directory name.
PR #4028 moved the check for autocomplete from action autocomplete to
the buffer one, which caused a few regression for upstream callers
(commandbar autocomplete & plugins that use buffer autocomplete)
that use the buffer autocomplete.
This commit restores pre #4028 behavior by adding a callback variant
for buffer autocomplete functions while keeping the multi-cursor
autocomplete function.
The plugin's own `basename()` only treated `\` as a separator on Windows,
so a linter reporting `a/b/d.c` for a buffer opened as `a\b\d.c` produced
no match and its messages were silently dropped. Windows accepts both
separators and a linter is free to normalize the path it prints.
`filepath` is already imported here and `filepath.Base()` handles both
separators on Windows while treating `\` as a regular filename character
everywhere else, so the hand-rolled helper can go away.
Fixes#3963
We like to have gofmt-ed files present in PRs before a review is done.
To reach this we let the PR test fail in the moment the files are not properly
formatted.
Micro's terminal library tcell interprets the color "0" as your terminal's
default text color, which is white or very light for most dark-themed
terminals. This makes the text almost unreadable when using the sunny-day
theme with a dark terminal! I'm changing the default color to black to match
the screenshot provided from the original theme source.
https://github.com/dwwmmn/micro-sunny-day
Fixing resize split can cause crashes when node is root.
"Regression" of #3983 where ResizeSplit() assumed that the root node
always has a single child which aligns to the previous behavior
Using file complete for the save command. This is useful when trying to
save as a different file or simply auto complete the directories you
want to save to
This argument allows us to execute one or more commands immediately
after editor initialization.
This is useful in cases where you know you are going to want to open
two panes immediately, or for scripting purposes so you can start
with certain things set up, or if you want to execute certain plugin
actions at startup, etc.
Usage:
micro -exec "...cmd..."
micro -exec "cmd1" -exec "cmd2" -exec "cmd3" ...
(multiple commands are gathered into an array and executed in order)
Commands are executed after plugin initialization, so you can use
plugin commands as well.
Updated man page with information about the new argument.
* Show array value type for pluginchannels and pluginrepos
Since the options pluginchannels and pluginrepos can have arrays of values, this should be what is in the default values.
It's even more obvious with pluginrepos since two consecutives ticks don't render as an empty formatted, but just the normal 2 caracters.
* Update default value description for indent-char
Show that it's an empty string (instead of 2 backticks that are rendering marks).
Otherwise we can't identify if we have the same file open multiple times via
different symlinks.
The test must be adapted to resolve symlinks in `findBuffer()`.