]> git.phdru.name Git - dotfiles.git/blobdiff - .vim/ftplugin/python.vim
.vim: Use `programming_lang.vim` in `python.vim`
[dotfiles.git] / .vim / ftplugin / python.vim
index 44ec35e0775cc24159e0afe9c385039ccf38b8bd..3037539de83f862a1572db3beaadb127c498e4b3 100644 (file)
@@ -17,13 +17,12 @@ if has("iconv") && !exists('b:encoding_set')
    endif
 endif
 
-setlocal fo-=t fo+=croql
+runtime! ftplugin/programming_lang.vim
 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;
@@ -32,7 +31,7 @@ function! SavePython()
    let ext = expand("%:e")
    if ext == "pyem"
       return
-   elif ext == "ptl"
+   elseif ext == "ptl"
       !compyle-ptl %
    else
       !compyle %
@@ -40,7 +39,10 @@ function! SavePython()
          !rm -f %[co]
       endif
       if getline(1) =~ "^#!"
-         !chmod +x %
+         call SetExecutableBit(1)
       endif
    endif
 endfunction
+
+" Avoid double indent. See https://stackoverflow.com/a/62348570/7976758
+let g:pyindent_open_paren=shiftwidth()