]> git.phdru.name Git - dotfiles.git/blobdiff - .vim/ftplugin/python.vim
.vim: Add SetExecutableBit based on Tip 212
[dotfiles.git] / .vim / ftplugin / python.vim
index 44ec35e0775cc24159e0afe9c385039ccf38b8bd..bc1f672ac7cd78551e3d6d3e5512669a3807619f 100644 (file)
@@ -17,13 +17,13 @@ if has("iconv") && !exists('b:encoding_set')
    endif
 endif
 
-setlocal fo-=t fo+=croql
+setlocal formatoptions-=t formatoptions+=croql
 setlocal keywordprg=pydoc
 setlocal shiftwidth=4 softtabstop=4
 compiler python
 
 if has("unix")
-   execute "autocmd BufWritePost " . expand("%") . " call SavePython()"
+   autocmd BufWritePost <buffer> call SavePython()
 endif
 
 " Compile and remove *.cgi[co] files after compilation; do not remove *.py[co] files;
@@ -40,7 +40,7 @@ function! SavePython()
          !rm -f %[co]
       endif
       if getline(1) =~ "^#!"
-         !chmod +x %
+         call SetExecutableBit(1)
       endif
    endif
 endfunction