如何格式化 zsh 代码(例如 prettier / shfmt)?

Tom*_*ale 8 zsh formatter prettier

对于bashsh,有shfmt

如何格式化zsh代码?

我希望能够设置一些选项,例如 in shfmt,即:

  -i uint   indent: 0 for tabs (default), >0 for number of spaces
  -bn       binary ops like && and | may start a line
  -ci       switch cases will be indented
  -sr       redirect operators will be followed by a space
  -kp       keep column alignment paddings
  -fn       function opening braces are placed on a separate line
Run Code Online (Sandbox Code Playgroud)

zsh-hist说它支持“统一代码格式”,但我不知道如何从命令行运行它,它的主要目的是历史操作。

如何zsh在 shell 中或通过 VSCode prettier 之类的工具格式化代码?