aboutsummaryrefslogblamecommitdiff
path: root/plugin/shebang_change_filetype.vim
blob: 03f58308512742d85bae95485c9d4443e8b8d138 (plain) (tree)
1
2
3
4
5
6
7
8
 

                                                                           



                                         
                                                                             







                                                                    
                                         

                            
                                 

           
"
" shebang_change_filetype.vim: Re-run filetype detection if a shebang #! is
" added or changed in the buffer.
"
" 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 *
          \ doautocmd InsertLeave
  endif
augroup END