]> 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 2aa92b056598bd9d44867b268ee8e7cd3cf762e0..3037539de83f862a1572db3beaadb127c498e4b3 100644 (file)
@@ -17,9 +17,8 @@ if has("iconv") && !exists('b:encoding_set')
    endif
 endif
 
-setlocal formatoptions-=t formatoptions+=croql
+runtime! ftplugin/programming_lang.vim
 setlocal keywordprg=pydoc
-setlocal shiftwidth=4 softtabstop=4
 compiler python
 
 if has("unix")
@@ -32,21 +31,18 @@ function! SavePython()
    let ext = expand("%:e")
    if ext == "pyem"
       return
-   elif ext == "ptl"
+   elseif ext == "ptl"
       !compyle-ptl %
    else
       !compyle %
       if ext != "py"
          !rm -f %[co]
       endif
-      if executable(expand('%:p')) || !executable('chmod')
-        return
-      endif
       if getline(1) =~ "^#!"
-         !chmod +x %
-         if v:shell_error
-            echoerr 'Cannot make file executable: ' . v:shell_error
-         endif
+         call SetExecutableBit(1)
       endif
    endif
 endfunction
+
+" Avoid double indent. See https://stackoverflow.com/a/62348570/7976758
+let g:pyindent_open_paren=shiftwidth()