Guest User

Untitled

a guest
Sep 12th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Apply automatic pep8 fixes from QuickFix window
  2. $ autopep8 --in-place spam.py
  3. $ git difftool spam.py # check edits in gVim, write to file
  4. $ git commit spam.py -m "Fix bad PEP8 formatting"
  5.  
  6. " copy this to your vimrc or source it
  7.  
  8. " tells vim not to automatically reload changed files
  9. set noautoread
  10.  
  11. function! DiffWithSaved()
  12. let filetype=&ft
  13. diffthis
  14. vnew | r # | normal! 1Gdd
  15. diffthis
  16. exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
  17. endfunction
  18.  
  19. " sets up mappings to function
  20.  
  21. com! DiffSaved call DiffWithSaved()
  22. map <Leader>ds :DiffSaved<CR>
  23.  
  24. " run these commands after sourcing the above function
  25.  
  26. " % expands to filename (also %:h to head, %:t to tail)
  27. " if it throws an error, just do :cd %:h first
  28.  
  29. :!autopep8 --in-place %
  30. :DiffSaved
Add Comment
Please, Sign In to add comment