home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / scripts.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  2.9 KB  |  102 lines

  1. " Vim syntax support file
  2. " Maintainer:    Bram Moolenaar <Bram@vim.org>
  3. " Last change:    1998 April 14
  4.  
  5. " This file is called by an autocommand for every file that has just been
  6. " loaded into a buffer.  It checks if the first line of the file is recognized
  7. " as a file for which syntax highlighting is supported.  Only do this if there
  8. " was no match with a filename extension.
  9.  
  10. if !has("syntax_items")
  11.  
  12.   " Source the user-specified syntax highlighting file
  13.   if exists("myscriptsfile")
  14.     if file_readable(expand(myscriptsfile))
  15.       execute "so " . myscriptsfile
  16.     endif
  17.   endif
  18.  
  19. endif
  20.  
  21.  
  22. if !has("syntax_items")
  23.  
  24.   " Bourne-like shell scripts: sh ksh bash
  25.   if getline(1) =~ '^#!.*[/\\][bk]\=a\=sh\>'
  26.     if exists("is_bash")
  27.       unlet is_bash
  28.     endif
  29.     if exists("is_kornshell")
  30.       unlet is_kornshell
  31.     endif
  32.     " if bash is sh on your system as on Linux, you may prefer to
  33.     " add the following in your .vimrc file:
  34.     " let bash_is_sh=1
  35.     if exists("bash_is_sh") || getline(1) =~ '^#!.*[/\\]bash\>'
  36.       let is_bash=1
  37.     elseif getline(1) =~ '^#!.*[/\\]ksh\>'
  38.       let is_kornshell=1
  39.     endif
  40.     so <sfile>:p:h/sh.vim
  41.  
  42.   " csh and tcsh scripts
  43.   elseif getline(1) =~ '^#!.*[/\\]t\=csh\>'
  44.     so <sfile>:p:h/csh.vim
  45.  
  46.   " Z shell scripts
  47.   elseif getline(1) =~ '^#!.*[/\\]zsh\>'
  48.     so <sfile>:p:h/zsh.vim
  49.  
  50.   " ELM Mail files
  51.   elseif getline(1) =~ '^From [a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\= .*[12][09]\d\d$'
  52.     so <sfile>:p:h/mail.vim
  53.  
  54.   " Expect scripts
  55.   elseif getline(1) =~ '^#!.*[/\\]expect\>'
  56.     so <sfile>:p:h/expect.vim
  57.  
  58.   " Makefiles
  59.   elseif getline(1) =~ '^#!.*[/\\][^/\\]*make\>'
  60.     so <sfile>:p:h/make.vim
  61.  
  62.   " Perl
  63.   elseif getline(1) =~ '^#!.*[/\\][^/\\]*perl[^/\\]*\>'
  64.     so <sfile>:p:h/perl.vim
  65.  
  66.   " Vim scripts (must have '" vim' as the first line to trigger this)
  67.   elseif getline(1) =~ '^" *[vV]im$'
  68.     so <sfile>:p:h/vim.vim
  69.  
  70.   " Diff file:
  71.   " - "diff" in first line (context diff)
  72.   " - "--- " in first line and "+++ " in second line (unified diff).
  73.   " - "*** " in first line and "--- " in second line (context diff).
  74.   elseif getline(1) =~ '^diff\>' || (getline(1) =~ '^--- ' && getline(2) =~ '^+++ ') || (getline(1) =~ '^\*\*\* ' && getline(2) =~ '^--- ')
  75.     so <sfile>:p:h/diff.vim
  76.  
  77.   " PostScript Files (must have %!PS as the first line, like a2ps output)
  78.   elseif getline(1) =~ '^%![ \t]*PS'
  79.     so <sfile>:p:h/postscr.vim
  80.  
  81.   " Awk scripts
  82.   elseif getline(1) =~ '^#!.*awk\>'
  83.     so <sfile>:p:h/awk.vim
  84.  
  85.   " AmigaDos scripts
  86.   elseif $TERM == "amiga" && (getline(1) =~ "^;" || getline(1) =~ '^\.[bB][rR][aA]')
  87.     so <sfile>:p:h/amiga.vim
  88.  
  89.   " SiCAD scripts (must have procn or procd as the first line to trigger this)
  90.   elseif getline(1) =~ '^ *[pP][rR][oO][cC][nNdD] *$'
  91.     source <sfile>:p:h/sicad.vim
  92.  
  93.   " Purify log files start with "****  Purify"
  94.   elseif getline(1) =~ '^\*\*\*\*  Purify'
  95.     source <sfile>:p:h/purifylog.vim
  96.  
  97.   endif
  98.  
  99. endif
  100.  
  101. " vim: ts=8
  102.