Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/purcell/emacs-nixfmt
Emacs package for reformatting Nix code using nixfmt
https://github.com/purcell/emacs-nixfmt
Last synced: about 2 months ago
JSON representation
Emacs package for reformatting Nix code using nixfmt
- Host: GitHub
- URL: https://github.com/purcell/emacs-nixfmt
- Owner: purcell
- Created: 2024-07-24T15:26:45.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-11-07T07:25:49.000Z (3 months ago)
- Last Synced: 2024-11-07T08:26:23.256Z (3 months ago)
- Language: Emacs Lisp
- Size: 7.81 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
[![Melpa Status](http://melpa.org/packages/nixfmt-badge.svg)](http://melpa.org/#/nixfmt)
[![Melpa Stable Status](http://stable.melpa.org/packages/nixfmt-badge.svg)](http://stable.melpa.org/#/nixfmt)
[![Build Status](https://github.com/purcell/emacs-nixfmt/actions/workflows/test.yml/badge.svg)](https://github.com/purcell/emacs-nixfmt/actions/workflows/test.yml)nixfmt.el
==============This Emacs library provides commands and a minor mode for easily reformatting
Nix source code using the [nixfmt][nixfmt] command.Installation
=============If you choose not to use one of the convenient
packages in [MELPA][melpa], you'll need to
add the directory containing `nixfmt.el` to your `load-path`, and
then `(require 'nixfmt)`.Usage
=====Customise the `nixfmt-command` variable as desired, then call
`nixfmt-buffer` or `nixfmt-region` as convenient.Enable `nixfmt-on-save-mode` in Nix buffers like this:
```el
(add-hook 'nix-mode-hook 'nixfmt-on-save-mode)
```or locally to your project with a form in your .dir-locals.el like
this:```el
((nix-mode
(mode . nixfmt-on-save)))
```You might like to bind `nixfmt` or `nixfmt-buffer` to a key,
e.g. with:```el
(define-key 'nix-mode-map (kbd "C-c C-f") 'nixfmt)
```[melpa]: http://melpa.org
[nixfmt]: https://github.com/nixos/nixfmt
[💝 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/)