diff --git a/README.md b/README.md index 0e60ef0a..57365e27 100644 --- a/README.md +++ b/README.md @@ -466,7 +466,8 @@ that caused Neoformat to be invoked. [`pydevf`](https://github.com/fabioz/PyDev.Formatter), [`isort`](https://github.com/timothycrosley/isort), [`docformatter`](https://github.com/myint/docformatter), - [`pyment`](https://github.com/dadadel/pyment) + [`pyment`](https://github.com/dadadel/pyment), + [`ruff`](https://github.com/astral-sh/ruff) - R - [`styler`](https://github.com/r-lib/styler), [`formatR`](https://github.com/yihui/formatR) diff --git a/autoload/neoformat/formatters/python.vim b/autoload/neoformat/formatters/python.vim index a6b98950..8257a3ca 100644 --- a/autoload/neoformat/formatters/python.vim +++ b/autoload/neoformat/formatters/python.vim @@ -1,5 +1,5 @@ function! neoformat#formatters#python#enabled() abort - return ['yapf', 'autopep8', 'black', 'isort', 'docformatter', 'pyment', 'pydevf'] + return ['yapf', 'autopep8', 'black', 'isort', 'docformatter', 'pyment', 'pydevf', 'ruff'] endfunction function! neoformat#formatters#python#yapf() abort @@ -58,3 +58,11 @@ function! neoformat#formatters#python#pydevf() abort \ 'replace': 1, \ } endfunction + +function! neoformat#formatters#python#ruff() abort + return { + \ 'exe': 'ruff', + \ 'stdin': 1, + \ 'args': ['format', '-q', '-'], + \ } +endfunction diff --git a/doc/neoformat.txt b/doc/neoformat.txt index 81e3da44..c09485c9 100644 --- a/doc/neoformat.txt +++ b/doc/neoformat.txt @@ -432,7 +432,8 @@ SUPPORTED FILETYPES *neoformat-supported-filetypes* [`pydevf`](https://github.com/fabioz/PyDev.Formatter), [`isort`](https://github.com/timothycrosley/isort), [`docformatter`](https://github.com/myint/docformatter), - [`pyment`](https://github.com/dadadel/pyment) + [`pyment`](https://github.com/dadadel/pyment), + [`ruff`](https://github.com/astral-sh/ruff) - R - [`styler`](https://github.com/r-lib/styler), [`formatR`](https://github.com/yihui/formatR)