2 years ago

#68345

test-img

Tom Hale

How do I format zsh code (something like prettier / shfmt)?

For bash and sh, there is shfmt.

How do I format zsh code?

I'd like to be able to set some options like in shfmt, ie:

  -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

zsh-hist says it supports "uniform code formatting", but I can't work out how to run it from the command line and it's main purpose is history manipulation.

How do I format zsh code either in the shell or via something like VSCode prettier?

zsh

prettier

formatter

0 Answers

Your Answer

Accepted video resources