Skip to content

a11ce/micro-autofmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

micro-autofmt

Multi-language formatting plugin for the Micro editor

Setup

  • git clone and make
  • Install whichever formatters you want to use

Usage

Commands in this section are micro commands. Use Ctrl-e to open the command bar inside micro. You can use setlocal in place of set to change a setting only in the current buffer.

Run fmt to format the current file with the default/chosen formatter, or fmt <name> to run a specific formatter (e.g. fmt ruff+check).

By default, files will be formatted on save. Disable with set autofmt.onsave false.

Formatters are named command invocations. For languages with multiple formatters, choose one with set autofmt.for-<language> <name> (e.g. set autofmt.for-python ruff). Some languages have multiple formatters that run the same command with different settings, see the exact invocations below.

To disable automatic formatting for a particular language, set its formatter to off (e.g. set autofmt.for-python off).

Supported formatters

The first formatter listed for each language is the default.

Language Formatter name(s)
C/C++/C# clang-format
CSS prettier
Go gofmt
HTML prettier
JavaScript prettier
JSON prettier
Lua stylua
Markdown prettier
Nix nixfmt
Python yapf, ruff, ruff+check, black
Racket raco-fmt
Rust rustfmt, rustfmt+nightly
Solidity forge-fmt
TypeScript prettier

Invocations

Name Invocation
black black -q
clang-format clang-format -i
forge-fmt forge fmt
gofmt gofmt -w
nixfmt nixfmt
prettier prettier --write --log-level silent
raco-fmt raco fmt --width 80 --max-blank-lines 2 -i
ruff ruff format -s
ruff+check ruff check --fix and ruff format -s
rustfmt rustfmt
rustfmt+nightly rustfmt +nightly
stylua stylua
yapf yapf -i

Credits

This project is intended as a replacement for the now-dead fmt-micro. o7


All contributions are welcome by pull request or issue.

micro-autofmt is licensed under the GNU General Public License v3.0. See LICENSE for full text.

About

Multi-language autoformatter for Micro

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors