I want that when i make create a particular file, suppose i create it in vim editor, the created file should get executable permission as well when it gets created . I want this as i am creating some python files and don't want to explicitly set permissions for the file so i want some way so that executable bit is set as soon i create a file with particular extension or with a particular editor.
For vim, you have powerful scripting available. For example, in my .vimrc, I have:
If you want to do it by filename only, instead of looking for the #! line, you could do:
That article on Debian Administration has instructions for EMACS as well.
As much as I like derobert's answer, it causes VIM to give me the following warning:
The following (somewhat longer) code solves that problem (requires a Python-enabled vim):