Repository for Micro editor plugins.
This repository currently contains three plugins: format, configdel, and
jsonschema.
plugins/<plugin-name>/: plugin source tree for each Micro plugin.plugins/format/: formatter plugin.plugins/configdel/: config key deletion plugin.plugins/jsonschema/: JSON Schema validation plugin.repo.json: repository metadata for Micro plugin installation.LICENSE,CONTRIBUTING.md,CODE_OF_CONDUCT.md,SECURITY.md: open source publication docs.
Formats the current buffer with an installed formatter matched to the file type.
Plugin files live under plugins/format/.
- Adds the
formatcommand. - Formats on save by default with
format.onsave. - Prefers project-local formatter binaries when available.
- Falls back to formatter executables on
$PATH.
oxfmt: JavaScript, TypeScript, JSX, TSX, JSON, JSON5, YAML, TOML, HTML, CSS, SCSS, Less, Markdown, MDX, GraphQL, Vue, Handlebars.ecs: PHP.gofmt: Go.ruff format, thenblack: Python.stylua: Lua.shfmt: shell.rustfmt: Rust.
Format the current buffer:
> format
Disable format-on-save for the current buffer:
> setlocal format.onsave false
Disable format-on-save globally:
> set format.onsave false
The current buffer must already be saved to disk.
The plugin checks for project-local tools first:
node_modules/.bin/oxfmtvendor/bin/ecs.venv/bin/ruffvenv/bin/ruff.venv/bin/blackvenv/bin/black
If none are found, it tries the matching global executable from $PATH.
Deletes the YAML or JSON key at the current cursor position using yq.
Plugin files live under plugins/configdel/.
- Adds the
del-keycommand andAlt-dkeybinding. - Deletes the YAML or JSON key nearest to the cursor.
- YAML key detection uses
yqline/column metadata for precision. - JSON key detection falls back to line-scanning heuristics.
- Errors clearly when
yqis not installed or the file type is unsupported.
yq(v4+) must be installed and available in your$PATH. Install from: https://github.com/mikefarah/yq/
- YAML:
.yml,.yaml - JSON:
.json
Place your cursor on or near the key you want to delete, then run:
> del-key
Or use the default keybinding:
Alt-d
- Object keys only (array element deletion is not targeted).
- JSON key detection is best-effort (yq does not provide line metadata for JSON).
Validates saved JSON files against the root $schema using Sourcemeta's
jsonschema CLI.
Plugin files live under plugins/jsonschema/.
- Adds the
validate-schemacommand. - Validates
.jsonfiles on save by default withjsonschema.onsave. - Surfaces schema failures as Micro buffer diagnostics.
- Enables remote schema resolution by default with
jsonschema.http.
- Install the
jsonschemaCLI and make sure it is available in your$PATH. - Supported install options include
mise use jsonschema, Homebrew, npm, PyPI, or Sourcemeta release binaries.
Validate the current buffer:
> validate-schema
Disable validation-on-save for the current buffer:
> setlocal jsonschema.onsave false
Disable validation-on-save globally:
> set jsonschema.onsave false
Disable remote HTTP schema resolution:
> set jsonschema.http false
- Only
.jsonfiles are supported in v0.1.0. - Validation runs against the saved file on disk.
- Relative
$schemapaths resolve from the file's directory.
Example files live under testdata/jsonschema/.
- Install the Sourcemeta CLI, for example with
mise use jsonschema. - Open
testdata/jsonschema/invalid-user.jsonin Micro with thejsonschemaplugin enabled. - Save the file.
- Confirm that Micro surfaces schema diagnostics for:
agebeing below the minimumextrabeing rejected byadditionalProperties
- Run
> validate-schemato trigger the same validation manually.
Clone or copy the plugin directory into Micro's plugin directory:
git clone https://github.com/aaronflorey/micro-plugins.git /tmp/micro-plugins
cp -R /tmp/micro-plugins/plugins/format ~/.config/micro/plug/format
cp -R /tmp/micro-plugins/plugins/configdel ~/.config/micro/plug/configdel
cp -R /tmp/micro-plugins/plugins/jsonschema ~/.config/micro/plug/jsonschemaRestart Micro after installing.
Add the raw file URL to your Micro config:
{
"pluginrepos": [
"https://github.com/aaronflorey/micro-plugins/main/repo.json"
]
}Then install a plugin:
micro -plugin install format
micro -plugin install configdel
micro -plugin install jsonschemaOr inside Micro:
> plugin install format
> plugin install configdel
> plugin install jsonschema
repo.jsonalready supports multiple plugin entries.- Each plugin should live in its own
plugins/<plugin-name>/directory. - Each published plugin should be packaged from that plugin directory, not from the monorepo root.
Before publishing this plugin, update repo.json so each entry's Website points at the
actual repository URL.
This repository uses lefthook for commit-time automation.
mise install
lefthook installOn commit-msg, if staged files include plugins/<name>/... and the commit message uses
Conventional Commits, the hook bumps that plugin's version in both:
plugins/<name>/*.lua(VERSION = "x.y.z")repo.json(Versions[0].Version)
Bump rules:
feat:-> minorfix:and all other conventional types -> patch!orBREAKING CHANGE:-> major