Background:
I'm using the (fantastic) Vim plugin python-mode, which includes the pep8 linter. The :PyLint
command runs all linters and opens errors in a QuickFix window.
Problem:
Now, let's assume I'm only using the pep8 linter, and I have a QuickFix window full of errors. I'd like to step through each of these errors and apply an automatic fix (with something like autopep8). The autopep8 tool is fantastic, but it makes mistakes. Ideally, I'd like to be able to supervise each fix in Vim (apply fix, check, move to next fix).
My current approach is to run autopep8 on my Python file, diff the results, then repair any bad changes:
$ autopep8 --in-place spam.py
$ git difftool spam.py # check edits in gVim, write to file
$ git commit spam.py -m "Fix bad PEP8 formatting"
However, this approach ruins my undo history, and seems needlessly complex. Is there a better way?
Question:
Is there any way to automatically apply pep8 fixes (when available) to pep8 errors within the QuickFix window?
autopep8
changes within the buffer using:PyLintAuto
. (However, there's no option to approve/deny changes one-by-one). – Mcgaha:PymodeLintAuto
– Bluecollar