newpythonfile.vim 553 B

1234567891011121314151617181920212223242526272829
  1. "
  2. " Just a little plugin to automatically set utf-8 for new Python files
  3. "
  4. if &compatible || v:version < 603
  5. finish
  6. endif
  7. fun! MakeNewPythonFile()
  8. " actions.py has another handler
  9. if expand("<afile>") == 'actions.py'
  10. return
  11. endif
  12. set nopaste
  13. 0 put = '#!/usr/bin/python'
  14. put = '# -*- coding: utf-8 -*-'
  15. put = ''
  16. 5
  17. endfun
  18. com! -nargs=0 NewPythonFile call MakeNewPythonFile()
  19. augroup NewPythonFile
  20. au!
  21. autocmd BufNewFile *.py call MakeNewPythonFile()
  22. augroup END
  23. " vim: set et foldmethod=marker : "