https://github.com/amake/shfmt.el
Shell script formatting and linting for Emacs via shfmt
https://github.com/amake/shfmt.el
auto-formatter emacs linter shell-script
Last synced: 2 months ago
JSON representation
Shell script formatting and linting for Emacs via shfmt
- Host: GitHub
- URL: https://github.com/amake/shfmt.el
- Owner: amake
- License: gpl-3.0
- Created: 2019-08-14T12:58:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-11T23:11:37.000Z (about 4 years ago)
- Last Synced: 2026-04-30T00:37:11.393Z (2 months ago)
- Topics: auto-formatter, emacs, linter, shell-script
- Language: Emacs Lisp
- Size: 26.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shfmt.el
Shell script formatting and linting with [shfmt](https://github.com/mvdan/sh)
# Installation
Install shfmt [per instructions](https://github.com/mvdan/sh#shfmt).
shfmt.el is not (yet) on MELPA so install it locally however you like. You will have
to install [`reformatter`](https://github.com/purcell/reformatter.el) and
[`flycheck`](https://www.flycheck.org/en/latest/) separately.
# Configuration
Manual formatting requires no configuration; just call `shfmt-buffer` or
`shfmt-region`. Enable `shfmt-on-save-mode` to auto-format on save. Add this to
the `sh-mode-hook` to enable automatically in new buffers.
Call `flycheck-shfmt-setup` to enable the Flycheck checker.
## Example
Using [`use-package`](https://jwiegley.github.io/use-package/), assuming
installed locally to `lisp/shfmt`:
```elisp
(use-package shfmt
:ensure nil
:load-path "lisp/shfmt"
:ensure-system-package shfmt
:hook (sh-mode . shfmt-on-save-mode))
(use-package flycheck-shfmt
:ensure nil
:after flycheck
:load-path "lisp/shfmt"
:config
(flycheck-shfmt-setup))
```
# License
GPL-3