GitMe installer does not need libexpat-1.dll
[msysgit.git] / share / vim / vim58 / scripts.vim
blobc8907a16f45c36d72d1e0d4ae6ab6f96995c3a63
1 " Vim support file to detect file types in scripts
3 " Maintainer:   Bram Moolenaar <Bram@vim.org>
4 " Last change:  2001 May 03
6 " This file is called by an autocommand for every file that has just been
7 " loaded into a buffer.  It checks if the type of file can be recognized by
8 " the file contents.  The autocommand is in $VIMRUNTIME/filetype.vim.
11 " Load the user defined scripts file first
12 " Only do this when the FileType autocommand has not been triggered yet
13 if !did_filetype() && exists("myscriptsfile") && file_readable(expand(myscriptsfile))
14   execute "source " . myscriptsfile
15 endif
17 " Only do this when the FileType autocommand has not been triggered yet
18 if !did_filetype()
20 " Line continuation is used here, remove 'C' from 'cpoptions'
21 let scr_cpo_save = &cpo
22 set cpo-=C
24 " Bourne-like shell scripts: sh ksh bash bash2
25 if getline(1) =~ '^#!.*[/\\]\(bash\|bash2\|ksh\|sh\)\>'
26   call SetFileTypeSH(getline(1))        " defined in filetype.vim
28 " csh and tcsh scripts
29 elseif getline(1) =~ '^#!.*[/\\]t\=csh\>'
30   set ft=csh
32 " Z shell scripts
33 elseif getline(1) =~ '^#!.*[/\\]zsh\>'
34         \ || getline(1) =~ '^#compdef\>'
35         \ || getline(1) =~ '^#autoload\>'
36   set ft=zsh
38 " TCL scripts
39 elseif getline(1) =~ '^#!.*[/\\]\(tclsh\|wish\|expectk\|itclsh\|itkwish\)\>'
40   set ft=tcl
42 " ELM Mail files
43 elseif getline(1) =~ '^From [a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\= .*[12][09]\d\d$'
44   set ft=mail
46 " Expect scripts
47 elseif getline(1) =~ '^#!.*[/\\]expect\>'
48   set ft=expect
50 " Gnuplot scripts
51 elseif getline(1) =~ '^#!.*[/\\]gnuplot\>'
52   set ft=gnuplot
54 " Makefiles
55 elseif getline(1) =~ '^#!.*[/\\][^/\\]*make\>'
56   set ft=make
58 " Perl
59 elseif getline(1) =~ '^#!.*[/\\][^/\\]*perl[^/\\]*\>'
60   set ft=perl
62 " Python
63 elseif getline(1) =~ '^#!.*[/\\][^/\\]*python[^/\\]*\>'
64   set ft=python
66 " Ruby
67 elseif getline(1) =~ '^#!.*[/\\][^/\\]*ruby[^/\\]*\>'
68   set ft=ruby
70 " BC calculator
71 elseif getline(1) =~ '^#!.*[/\\]bc\>'
72   set ft=bc
74 " sed
75 elseif getline(1) =~ '^#!.*sed\>'
76   set ft=sed
78 " Vim scripts (must have '" vim' as the first line to trigger this)
79 elseif getline(1) =~ '^" *[vV]im$'
80   set ft=vim
82 " Diff file:
83 " - "diff" in first line (context diff)
84 " - "Only in " in first line
85 " - "--- " in first line and "+++ " in second line (unified diff).
86 " - "*** " in first line and "--- " in second line (context diff).
87 " - "# It was generated by makepatch " in the second line (makepatch diff).
88 " - "Index: <filename>" in the first line (CVS file)
89 elseif getline(1) =~ '^diff\>' || getline(1) =~ '^Only in '
90         \ || (getline(1) =~ '^--- ' && getline(2) =~ '^+++ ')
91         \ || (getline(1) =~ '^\*\*\* ' && getline(2) =~ '^--- ')
92         \ || getline(1) =~ '^\d\+\(,\d\+\)\=[cda]\d\+\>'
93         \ || getline(2) =~ '^# It was generated by makepatch '
94         \ || getline(1) =~ '^Index:\s\+\f\+$'
95         \ || getline(1) =~ '^==== //\f\+#\d\+'
96   set ft=diff
98 " PostScript Files (must have %!PS as the first line, like a2ps output)
99 elseif getline(1) =~ '^%![ \t]*PS'
100   set ft=postscr
102 " Awk scripts
103 elseif getline(1) =~ '^#!.*awk\>'
104   set ft=awk
106 " M4 scripts: Guess there is a line that starts with "dnl".
107 elseif getline(1) =~ '^\s*dnl\>'
108         \ || getline(2) =~ '^\s*dnl\>'
109         \ || getline(3) =~ '^\s*dnl\>'
110         \ || getline(4) =~ '^\s*dnl\>'
111         \ || getline(5) =~ '^\s*dnl\>'
112   set ft=m4
114 " AmigaDos scripts
115 elseif $TERM == "amiga"
116         \ && (getline(1) =~ "^;" || getline(1) =~ '^\.[bB][rR][aA]')
117   set ft=amiga
119 " SiCAD scripts (must have procn or procd as the first line to trigger this)
120 elseif getline(1) =~ '^ *[pP][rR][oO][cC][nNdD] *$'
121   set ft=sicad
123 " Purify log files start with "****  Purify"
124 elseif getline(1) =~ '^\*\*\*\*  Purify'
125   set ft=purifylog
127 " XML
128 elseif getline(1) =~ '<?\s*xml.*?>'
129   set ft=xml
131 " XXD output
132 elseif getline(1) =~ '^\x\{7}: \x\{2} \=\x\{2} \=\x\{2} \=\x\{2} '
133   set ft=xxd
135 " RCS/CVS log output
136 elseif getline(1) =~ '^RCS file:' || getline(2) =~ '^RCS file:'
137   set ft=rcslog
139 " CVS commit
140 elseif getline(2) =~ '^CVS:'
141    set ft=cvs
143 " SNNS files
144 elseif getline(1) =~ '^SNNS network definition file'
145   set ft=snnsnet
146 elseif getline(1) =~ '^SNNS pattern definition file'
147   set ft=snnspat
148 elseif getline(1) =~ '^SNNS result file'
149   set ft=snnsres
151 " Virata
152 elseif getline(1) =~ '^%.\{-}[Vv]irata'
153         \ || getline(2) =~ '^%.\{-}[Vv]irata'
154         \ || getline(3) =~ '^%.\{-}[Vv]irata'
155         \ || getline(4) =~ '^%.\{-}[Vv]irata'
156         \ || getline(5) =~ '^%.\{-}[Vv]irata'
157   set ft=virata
159 " Website MetaLanguage
160 elseif getline(1) =~ '^#!.*wml.*'
161   set ft=wml
163 " Strace
164 elseif getline(1) =~ '^execve('
165   set ft=strace
167 " VSE JCL
168 elseif getline(1) =~ '^\* $$ JOB\>' || getline(1) =~ '^// *JOB\>'
169   set ft=vsejcl
171 " TAK and SINDA
172 elseif getline(4) =~ 'K & K  Associates' || getline(2) =~ 'TAK 2000'
173   set ft=takout
174 elseif getline(3) =~ 'S Y S T E M S   I M P R O V E D '
175   set ft=sindaout
176 elseif getline(6) =~ 'Run Date: '
177   set ft=takcmp
178 elseif getline(9) =~ 'Node    File  1'
179   set ft=sindacmp
181 " DNS zone files
182 elseif getline(1) =~ '\($ORIGIN\|$TTL\|IN\s*SOA\)' 
183       \ || getline(2) =~ '\($ORIGIN\|$TTL\|IN\s*SOA\)'
184       \ || getline(1).getline(2).getline(3).getline(4) =~ 'BIND.*named'
185   set ft=dns
187 " Generic configuration file (check this last, it's just guessing!)
188 elseif getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
189         \ || getline(4) =~ '^#' || getline(5) =~ '^#'
190   set ft=conf
192 endif
194 " Restore 'cpoptions'
195 let &cpo = scr_cpo_save
196 unlet scr_cpo_save
198 endif " !did_filetype()
200 " vim: ts=8 tw=0 sts=0