aboutsummaryrefslogtreecommitdiff
path: root/plugin/shebang_create_exec.vim
blob: c93628a80d10ca23342158a69242c2251d2d3b46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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('loaded_shebang_create_exec') || &compatible || v:version < 700
  finish
endif
if !has('unix')
  finish
endif
let 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#(expand('<afile>:p'))
augroup END