aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin/shebang_create_exec.vim
blob: 401a23b85365784f0e935058af70e81c114163ed (plain)
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('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