Provides commands, which use the external yapf tool to tidy up the current buffer according to Python’s PEP8.
$ pip install yapf
$ wget https://raw.githubusercontent.com/paetzke/py-yapf.el/master/py-yapf.el \
-O /your/path/py-yapf.elYou can also install py-yapf with MELPA:
M-x package-install RET
py-yapf RETAdd the save hook to your ~/.emacs
(add-to-list 'load-path "/your/path/")
(require 'py-yapf)
(add-hook 'python-mode-hook 'py-yapf-enable-on-save)Now every time you save your Python file yapf will be executed on the current buffer.
M-x py-yapf-buffer RET: Uses theyapftool to reformat the current buffer.
Feel free to open tickets or send pull requests with improvements. These contributors have done so.
Copyright (c) 2015 Friedrich Pätzke. See LICENSE for further details.
So long. Friedrich.