sponsor Vim development Vim logo Vim Book Ad

Shebang : Make executable by setting the correct shebang and executable bit

 script karma  Rating 4/7, Downloaded by 1288  Comments, bugs, improvements  Vim wiki

created by
Johannes Hoff
 
script type
utility
 
description
This script tries to reduce the repetitive work it is to make a file executable. It provides three functions:

SetShebang() which sets the correct shebang (e.g. "#!/usr/bin/python"),
SetExecutableBit() which sets the executable bit, and
SetExecutable() which calls the two functions above.

The SetExecutableBit() is simply stolen from http://vim.wikia.com/wiki/Setting_file_attributes_without_reloading_a_buffer . Thanks a lot Max Ischenko!
 
install details
Put this file in your .vim/plugin folder and map a key to call SetExecutable. For example, in my vimrc, I have

map <leader>X :w<CR>:call SetExecutable()<CR>
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
shebang.vim 1.1 2012-06-06 7.0 Johannes Hoff Support for more filetypes
shebang.vim 1.0 2010-12-13 7.0 Johannes Hoff Initial upload
ip used for rating: 18.191.5.239

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github