Skip to content

scop/emacs-ruff-format

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Melpa Status

ruff-format.el

This Emacs library provides commands and a minor mode for easily reformatting Python source code using Ruff.

Installation

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

reformatter is required.

Usage

Customise the ruff-format-command variable as desired, then call ruff-format-buffer or ruff-format-region as convenient.

Enable ruff-format-on-save-mode in Python mode buffers like this:

(add-hook 'python-mode-hook 'ruff-format-on-save-mode)

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

((python-mode
   (mode . ruff-format-on-save)))

License

SPDX-License-Identifier: GPL-3.0-or-later

About

Format Python source in Emacs using Ruff

Resources

License

Stars

Watchers

Forks