aboutsummaryrefslogtreecommitdiff
path: root/autoload/shebang_change_filetype.vim
blob: 447ac2be4c2cf59a6b02daeb5fb030886e6e5844 (plain) (blame)
1
2
3
4
5
6
7
8
" Check whether the first line was changed and looks like a shebang, and if
" so, re-run filetype detection
function! shebang_change_filetype#() abort
  if line("'[") == 1
        \ && strpart(getline(1), 0, 2) ==# '#!'
    doautocmd filetypedetect BufRead
  endif
endfunction