blob: 0bb1e51966e8f7dfec284168674e52ac04e46431 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
"
" shebang_change_filetype.vim: On leaving insert mode, check whether the first
" line was changed and looks like a shebang format.
"
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
if exists('loaded_shebang_change_filetype') || &compatible || v:version < 700
finish
endif
let loaded_shebang_change_filetype = 1
" Set up hook for before writes to check the buffer for new shebangs
augroup shebang_change_filetype
autocmd!
autocmd InsertLeave *
\ call shebang_change_filetype#()
if exists('##TextChanged')
autocmd TextChanged *
\ call shebang_change_filetype#()
endif
augroup END
|