]> git.phdru.name Git - dotfiles.git/commitdiff
Feat(.vim/ftplugin/python.vim): Do not call chmod if not required
authorOleg Broytman <phd@phdru.name>
Tue, 4 Jul 2017 20:46:02 +0000 (23:46 +0300)
committerOleg Broytman <phd@phdru.name>
Tue, 4 Jul 2017 20:46:02 +0000 (23:46 +0300)
Do not call chmod if the script is already executable
or chmod is not available in the wrong OS.

.vim/ftplugin/python.vim

index c2367b661b124378e7aad6b96aea3893bd0c03db..75f2e51334b8c4a7b4f75282a625ce67f3ad6cc3 100644 (file)
@@ -39,6 +39,9 @@ function! SavePython()
       if ext != "py"
          !rm -f %[co]
       endif
+      if executable(expand('%:p')) || !executable('chmod')
+        return
+      endif
       if getline(1) =~ "^#!"
          !chmod +x %
       endif