diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-17 16:15:31 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-17 16:15:31 +1200 |
commit | b8ffbf999555c72fa10aa9af3bca310ed3acf5c4 (patch) | |
tree | 621298221f15797a31cc3129506805c62b05c7ab /plugin | |
download | vim-shebang-create-exec-0.1.0.tar.gz (sig) vim-shebang-create-exec-0.1.0.zip |
First versionv0.1.0
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/shebang_create_exec.vim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/plugin/shebang_create_exec.vim b/plugin/shebang_create_exec.vim new file mode 100644 index 0000000..401a23b --- /dev/null +++ b/plugin/shebang_create_exec.vim @@ -0,0 +1,21 @@ +" +" shebang_create_exec.vim: Make a file executable on first save if it starts with a +" shebang. +" +" Author: Tom Ryder <tom@sanctum.geek.nz> +" License: Same as Vim itself +" +if exists('g:loaded_shebang_create_exec') || &compatible + finish +endif +if !has('autocmd') || !has('unix') || !exists('*shellescape') + finish +endif +let g:loaded_shebang_create_exec = 1 + +" Set up hook for before writes to check the buffer for new shebangs +augroup shebang_create_exec + autocmd! + autocmd BufWritePre * + \ call shebang_create_exec#Check(expand('<afile>:p')) +augroup END |