" Vim syntax support file
" Maintainer:	Bram Moolenaar <mool@oce.nl>
" Last change:	1997 May 7

" This file is called by an autocommand for every file that has just been
" loaded into a buffer.  It checks if the first line of the file is recognized
" as a file for which syntax highlighting is supported.  Only do this if there
" was no match with a filename extension.

if !has("syntax_items")

  " Bourne-like shell scripts: sh ksh bash
  if getline(1) =~ "^#!.*/[bk]\\=a\\=sh\\>"
    if exists("is_bash")
      unlet is_bash
    endif
    if exists("is_kornshell")
      unlet is_kornshell
    endif
    " if bash is sh on your system as on Linux, you may prefer to
    " add the following in your .vimrc file:
    " let bash_is_sh=1
    if exists("bash_is_sh") || getline(1) =~ "^#!.*/bash\\>"
      let is_bash=1
    elseif getline(1) =~ "^#!.*/ksh\\>"
      let is_kornshell=1
    endif
    source <sfile>:p:h/sh.vim

  " ELM Mail files
  elseif getline(1) =~ "^From [a-zA-Z][a-zA-Z_0-9\.-]*@.*[12][09][0-9][0-9]$"
    source <sfile>:p:h/mail.vim

  " Z shell scripts
  elseif getline(1) =~ "^#!.*/zsh\\>"
    source <sfile>:p:h/zsh.vim

  " Perl
  elseif getline(1) =~ "^#!.*/[^/]*perl[^/]*\\>"
    source <sfile>:p:h/perl.vim

  " Vim scripts (must have " vim as the first line to trigger this)
  elseif getline(1) =~ "^\" *[vV]im$"
    source <sfile>:p:h/vim.vim

  endif
endif
