Skip to content

purcell/emacs-nixpkgs-fmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Melpa Status Melpa Stable Status Build Status Support me

nixpkgs-fmt.el

This Emacs library provides commands and a minor mode for easily reformatting Nix source code using the nixpkgs-fmt command.

Installation

If you choose not to use one of the convenient packages in MELPA, you'll need to add the directory containing nixpkgs-fmt.el to your load-path, and then (require 'nixpkgs-fmt).

Usage

Customise the nixpkgs-fmt-command variable as desired, then call nixpkgs-fmt-buffer or nixpkgs-fmt-region as convenient.

Enable nixpkgs-fmt-on-save-mode in Nix buffers like this:

(add-hook 'nix-mode-hook 'nixpkgs-fmt-on-save-mode)

or locally to your project with a form in your .dir-locals.el like this:

((nix-mode
   (mode . nixpkgs-fmt-on-save)))

You might like to bind nixpkgs-fmt or nixpkgs-fmt-buffer to a key, e.g. with:

(define-key 'nix-mode-map (kbd "C-c C-f") 'nixpkgs-fmt)

💝 Support this project and my other Open Source work

💼 LinkedIn profile

✍ sanityinc.com

🐦 @sanityinc

About

Reformat Nix code with nixpkgs-fmt in Emacs

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published