aboutsummaryrefslogtreecommitdiff
path: root/plugin/shebang_create_exec.vim
blob: 91d2f841b9f178d1055f6128137cbdb8580ad11a (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
  finish
endif
if !has('autocmd') || !has('unix') || !exists('*shellescape')
  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#Check(expand('<afile>:p'))
augroup END