Is there any way to set +x bit on script while creating?For example I run:vim -some_option_to_make_file_executable script.shand after saving I can run file without any additional movings.ps. I can run chmod from vim or even from console itself, but this is a little annoying, cause vim suggests to reload file. Also it's annoying to type chmod command every time.pps. It would be great to make it depending on file extension (I don't need executable .txt :-) )
vim: create file with +x bit
shell script;vim;executable;chmod
I don't recall where I found this, but I use the following in my ~/.vimrc Set scripts to be executable from the shellau BufWritePost * if getline(1) =~ ^#! | if getline(1) =~ /bin/ | silent !chmod +x <afile> | endif | endifThe command automatically sets the executable bit if the first line starts with #! or contains /bin/.