A simple and extensible yaml formatter.
go install github.com/UltiRequiem/yamlfmt@latest
You can also use the binaries from releases.
-
To format one or more files and write to stdout:
yamlfmt a.yaml b.yaml c.yaml
-
To format one or more files in the replace mode:
yamlfmt -w a.yaml b.yaml c.yaml
If you want to log the files that have been formatted, you can use the
-l
flag also. -
To format stdin and write to stdout:
cat a.yaml | yamlfmt
-
To format stdin and write to a file:
cat a.yaml | yamlfmt > b.yaml
-
To format every file in your current directory and subdirectories:
-
Using
find
:yamlfmt -w $(find -name "*.yaml")
-
Using
fd
:yamlfmt -w $(fd -H -e yaml)
-
au FileType yaml let &l:formatprg= "yamlfmt /dev/stdin"
It can Probably integrate with others editors easily but I only use Neovim. If you know how to integrate it with some other editor, please open a pull requests or issue with the information.
Eliaz Bobadilla - Creator and Maintainer 💪
See also the full list of contributors who participated in this project ✨
Open an Issue, I will check it a soon as possible 👀
If you want to hurry me up a bit send me a tweet 😆
Consider supporting me on Patreon if you like my work 🙏
Don't forget to star the repo ⭐
Licensed under the MIT License 📄