Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Apply automatic pep8 fixes from QuickFix window
- $ 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"
- " copy this to your vimrc or source it
- " tells vim not to automatically reload changed files
- set noautoread
- function! DiffWithSaved()
- let filetype=&ft
- diffthis
- vnew | r # | normal! 1Gdd
- diffthis
- exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
- endfunction
- " sets up mappings to function
- com! DiffSaved call DiffWithSaved()
- map <Leader>ds :DiffSaved<CR>
- " run these commands after sourcing the above function
- " % expands to filename (also %:h to head, %:t to tail)
- " if it throws an error, just do :cd %:h first
- :!autopep8 --in-place %
- :DiffSaved
Add Comment
Please, Sign In to add comment