Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 1.07 KB

README.md

File metadata and controls

42 lines (30 loc) · 1.07 KB

shfmt.el

Shell script formatting and linting with shfmt

Installation

Install shfmt per instructions.

shfmt.el is not (yet) on MELPA so install it locally however you like. You will have to install reformatter and flycheck 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, assuming installed locally to lisp/shfmt:

(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