Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/purcell/emacs-shfmt
Reformat shell script code in Emacs using shfmt
https://github.com/purcell/emacs-shfmt
Last synced: 3 days ago
JSON representation
Reformat shell script code in Emacs using shfmt
- Host: GitHub
- URL: https://github.com/purcell/emacs-shfmt
- Owner: purcell
- Created: 2020-04-21T00:53:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-07T07:36:46.000Z (3 months ago)
- Last Synced: 2024-12-02T18:04:19.154Z (2 months ago)
- Language: Emacs Lisp
- Size: 20.5 KB
- Stars: 38
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
[![Melpa Status](http://melpa.org/packages/shfmt-badge.svg)](http://melpa.org/#/shfmt)
[![Melpa Stable Status](http://stable.melpa.org/packages/shfmt-badge.svg)](http://stable.melpa.org/#/shfmt)
[![Build Status](https://github.com/purcell/emacs-shfmt/actions/workflows/test.yml/badge.svg)](https://github.com/purcell/emacs-shfmt/actions/workflows/test.yml)shfmt.el
==============This Emacs library provides commands and a minor mode for easily reformatting
shell script source code using the [shfmt][shfmt] program.Installation
=============If you choose not to use one of the convenient
packages in [MELPA][melpa], you'll need to
add the directory containing `shfmt.el` to your `load-path`, and
then `(require 'shfmt)`.Usage
=====Customise the `shfmt-command` variable as desired, then call
`shfmt-buffer` or `shfmt-region` as convenient.Enable `shfmt-on-save-mode` in Shell Mode buffers like this:
```el
(add-hook 'sh-mode-hook 'shfmt-on-save-mode)
```or locally to your project with a form in your .dir-locals.el like
this:```el
((sh-mode
(mode . shfmt-on-save)))
```You might like to bind `shfmt` or `shfmt-buffer` to a key,
e.g. with:```el
(define-key 'sh-mode-map (kbd "C-c C-f") 'shfmt)
```[melpa]: http://melpa.org
[shfmt]: https://github.com/mvdan/sh
[💝 Support this project and my other Open Source work](https://www.patreon.com/sanityinc)
[💼 LinkedIn profile](https://uk.linkedin.com/in/stevepurcell)
[✍ sanityinc.com](http://www.sanityinc.com/)