Jump to content

Formatter

From ArchWiki

A formatter is a program that automatically indents program source code according to some rules, either predefined or declared in a configuration file.

A formatter for your programming language can be installed natively using the following packages.

Tip If your language is not in the list, search in the Arch official repositories or in the AUR. Some programming languages have their own package registry and you may have better luck finding formatter for that language there if it is not packaged in the Arch official repositories or AUR. Lastly, you can try package mangers focusing on development tools like Nix or mise.
Note
  • If you want to integrate a formatter into your text editor (e.g. add format-on-save functionality), refer to Language Server Protocol page. Some Language Servers provide formatting functionality built in, while others require external formatting provider. In such case, look for it in this list.
  • Some programming languages provide a formatter out of the box, so you only need to install the package for their official compiler/interpreter or build system. If this is the case, it will be listed here as "Formatter package".
Language Formatter Formatter package
Angular prettier prettier
Arduino
Ansible
Astrojs
Bash shfmt shfmt
Bicep
C, C++, Objective-C clang-format clang
C# csharpier csharpierAUR
Clojure cljfmt cljfmt-binAUR
CMake cmake_format, gersemi cmake-formatAUR, python-gersemi
CSS, LESS, SASS prettier, biome prettier, biome
Crystal crystal tool format crystal
D dfmt dfmt
Dart dart format dart
Dockerfile, Dockercompose
Elixir mix format elixir
Elm elm-format elm-format-binAUR
Erlang erlfmt erlfmt-gitAUR
Fish fish_indent fish
Flow prettier prettier
Fortran fprettify fprettifyAUR
F# fantomas fantomas-binAUR
GDScript
General purpose prettier, uncrustify, astyle, clang-format prettier, uncrustify, astyle, clang
Gleam gleam format gleam
GOlang go fmt go
GraphQL prettier, biome prettier, biome
Groovy
Haskell ormolu, fourmolu, stylish-haskell, hindent haskell-ormolu, haskell-fourmolu, stylish-haskell, hindent
Haxe
HTML prettier, biome prettier, biome
JavaScript prettier, biome prettier, biome
Java google-java-format google-java-formatAUR
JSON prettier, biome, jqlang prettier, biome, jq
Julia
Kotlin ktlint, ktfmt ktlint, ktfmtAUR
Lua stylua stylua
Markdown prettier, mdformat prettier, mdformat
Nim nph nph-binAUR
nix nixfmt nixfmtAUR
OCaml, Reason dune fmt dune
Odin odinfmt odinfmt
OmniSharp
Perl
PHP
PowerShell
PureScript
Python black, ruff python-black, ruff
R
Racket
ReScript
Rome
Rust rustfmt rust
Ruby rubocop rubocop
Scala scalafmt scalafmtAUR
SQL
Svelte
Swift swift-format swift-formatAUR
SystemVerilog
Terraform
(La)TeX
TypeScript prettier, biome prettier, biome
Typst typstyle typstyle
Vala
Vue prettier prettier
YAML prettier prettier
Zig zig fmt zig