Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.
/ fmt-micro Public archive

A multi-language formatting plugin for the Micro text-editor. Moved to Gitlab

License

Notifications You must be signed in to change notification settings

sum01/fmt-micro

Repository files navigation

fmt-micro

GitHub tag Gitter

This is a multi-language formatting plugin for the Micro text-editor.

This plugin does NOT bundle any formatters, so you must install whichever you want to use.

Installation: Just run plugin install fmt and restart Micro 👍

Language Support

Is your favorite formatter missing? Make a request in the issue tracker, or submit a PR 😄

Language Supported Formatter(s)
C clang-format, uncrustify
C# uncrustify
C++ clang-format, uncrustify
CSS csscomb, js-beautify, prettier
Clojure cljfmt
CoffeeScript coffee-fmt
Crystal crystal
D dfmt, uncrustify
Dart dartfmt
Elm elm-format
Fish fish_indent
Flow prettier
Fortran fprettify
Go gofmt, goimports
GraphQL prettier
HTML htmlbeautifier, js-beautify, tidy
Haskell stylish-haskell
JSON prettier
JSX prettier
Java uncrustify
JavaScript js-beautify, prettier
LaTeX latexindent
Less prettier
Lua luafmt
Markdown prettier
Marko marko-prettyprint
OCaml ocp-indent
Objective-C clang-format, uncrustify
PHP php-cs-fixer
Pawn uncrustify
Perl perltidy
Pug pug-beautifier-cli
Puppet puppet-lint
Python autopep8, yapf
Ruby rubocop, rufo
Rust rustfmt
Sass prettier
Shell beautysh, sh
TypeScript prettier, tsfmt
Vala uncrustify
XML tidy
YAML align-yaml

Usage

The formatter will run on-save, unless fmt-onsave is set to false.

Run help fmt to bring up a help file while in Micro.

Commands

  • fmt to run the formatter on the current file.
  • fmt formattername to run the specified formatter on the current file without affecting your settings.
  • fmt list to output the supported formatters to Micro's log.
  • fmt update to force an update of the in-memory formatter settings.
    Useful for after adding a config file, or changing editor settings.
  • fmt setall formattername to set the specified formatter to be used in all the options of its supported language types.
  • fmt unsetall formattername to unset all settings the specified formatter is currently set to.
    This is useful for if you uninstalled a formatter.

Using Custom Formatter/Args

You can add your own formatter, or just use different args, by adding its command (and filetype) into settings.json
The format looks like "fmt|js": "prettier --write" in your settings.json.

Note that you must use the filetype detected by Micro, and if it's Unknown then use it's literal filetype extension (ex: p for Pawn)
You can check a file's type by running show filetype