Formatter Support
BashSupport Pro provides two different formatter engines to choose from:
- a formatter based on shfmt 3.11.0. shfmt binaries are bundled with the plugin, but you still can use a version, which is installed on your system.
- a native formatter
In version 5.0 of BashSupport Pro, shfmt remains the default formatter until the native formatter has been tested more widely. Historically, only the shfmt formatter has been available for versions prior to 5.0.
Code Style Settings
Engine and Style
- Formatter Engine for Bash and POSIX
- This configures the formatter to format Bash and POSIX scripts. Because shfmt does not support the Z Shell, the native formatter is always used for Zsh scripts.
- Follow Google Shell Style Guild
- This configures the formatter to follow the Google Shell Style Guide.

Tabs and Indents
On this page, the basic settings for tabs and indents are configured.
All settings except for “Indent switch cases” are common settings of the IDE. Please refer to the IntelliJ IDEA documentation for more information.
The shfmt engine does not support “Smart tabs” and “Continuation indent”.
- Indent switch cases
- If this option is enabled, then the patterns inside
case ... block
command are indented from the level of thecase
keyword.

Spaces
On this page the optional spaces of shell script syntax are configured.
With shfmt, only “Redirect operators” is supported. All other settings are only available with the native formatter.

Wrapping and Braces
With shfmt, only “Wrap before function body” is supported. All other settings are only available with the native formatter.
The common settings “Hard wrap at”, “Wrap on typing” and “Visual guides” are explained in the IntelliJ IDEA documentation.

Blank Lines
On this page, the handling of blank lines is configured. These settings are only available with the native formatter.

Other
On this page, the remaining settings are configured.
- Add a space at comment start
- If this option is enabled, then a space is added after the
#
character in a comment. This only applies to new comments in your editor unless “Force space on reformat” is enabled, too. - Force space on reformat
- If this option is enabled, then all comments are updated with a space after the
#
character when you reformat code. - Keep trailing semicolons
- If this option is enabled, then optional trailing semicolons are kept in the code. By default, optional semicolons are removed.

Application Settings
The formatter engine is configured at Settings… → Editor → Code Style → BashSupport Pro → Engine and Style. If shfmt is selected, then only the compatible options are available in the other tabs of the settings. Most settings are only supported by the native formatter.
BashSupport Pro bundles shfmt binaries for macOS, Linux and Windows. If you want to use a locally installed version of shfmt, then you can set your own path at Settings… → Languages & Frameworks → BashSupport Pro.

Limitations of the shfmt Engine
Most available settings are only available with the native formatter engine.
With shfmt, formatting only the selected text or a part of a file is not supported.