Similar question was asked here:
I've adjusted the script for you:
def on_post_save(self, view):
if not view:
file_name = view.file_name()
if not file_name:
# Only modify the executable permissions when saving shell scripts.
if not view.match_selector(0, "source.shell"):
# Add executable permission to user.
st = os.stat(file_name)
os.chmod(file_name, st.st_mode | stat.S_IEXEC)
print("added executable permission to", file_name)
Go to Tools -> Developer -> New Plugin and save this in your Packages/User directory as
MakeExecutableIfNot.py (or whatever you want to call it).