annotate runtime/scripts.vim @ 47:eff3887963cc

updated for version 7.0028
author vimboss
date Sun, 02 Jan 2005 11:28:13 +0000
parents 404aac550f35
children 7fd70926e2e1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim support file to detect file types in scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
26
404aac550f35 updated for version 7.0017
vimboss
parents: 22
diff changeset
4 " Last change: 2004 Oct 02
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " This file is called by an autocommand for every file that has just been
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " loaded into a buffer. It checks if the type of file can be recognized by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " the file contents. The autocommand is in $VIMRUNTIME/filetype.vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " Only do the rest when the FileType autocommand has not been triggered yet.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 if did_filetype()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " Load the user defined scripts file first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 " Only do this when the FileType autocommand has not been triggered yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 if exists("myscriptsfile") && file_readable(expand(myscriptsfile))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 execute "source " . myscriptsfile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 if did_filetype()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " Line continuation is used here, remove 'C' from 'cpoptions'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 let s:cpo_save = &cpo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 set cpo&vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 let s:line1 = getline(1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 if s:line1 =~ "^#!"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " A script that starts with "#!".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " Check for a line like "#!/usr/bin/env VAR=val bash". Turn it into
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " "#!/usr/bin/bash" to make matching easier.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 if s:line1 =~ '^#!\s*\S*\<env\s'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 let s:line1 = substitute(s:line1, '\S\+=\S\+', '', 'g')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 let s:line1 = substitute(s:line1, '\<env\s\+', '', '')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " Get the program name.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " Only accept spaces in PC style paths: "#!c:/program files/perl [args]".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 " If there is no path use the first word: "#!perl [path/args]".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 " Otherwise get the last word after a slash: "#!/usr/bin/perl [path/args]".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 if s:line1 =~ '^#!\s*\a:[/\\]'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 let s:name = substitute(s:line1, '^#!.*[/\\]\(\i\+\).*', '\1', '')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 elseif s:line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 let s:name = substitute(s:line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 let s:name = substitute(s:line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
53 " Bourne-like shell scripts: bash bash2 ksh ksh93 sh
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
54 if s:name =~ '^\(bash\d*\|\|ksh\d*\|sh\)\>'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 call SetFileTypeSH(s:line1) " defined in filetype.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 " csh scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 elseif s:name =~ '^csh\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 if exists("g:filetype_csh")
26
404aac550f35 updated for version 7.0017
vimboss
parents: 22
diff changeset
60 call SetFileTypeShell(g:filetype_csh)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 else
26
404aac550f35 updated for version 7.0017
vimboss
parents: 22
diff changeset
62 call SetFileTypeShell("csh")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 " tcsh scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 elseif s:name =~ '^tcsh\>'
26
404aac550f35 updated for version 7.0017
vimboss
parents: 22
diff changeset
67 call SetFileTypeShell("tcsh")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " Z shell scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 elseif s:name =~ '^zsh\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 set ft=zsh
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 " TCL scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 elseif s:name =~ '^\(tclsh\|wish\|expectk\|itclsh\|itkwish\)\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 set ft=tcl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 " Expect scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 elseif s:name =~ '^expect\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 set ft=expect
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 " Gnuplot scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 elseif s:name =~ '^gnuplot\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 set ft=gnuplot
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 " Makefiles
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 elseif s:name =~ 'make\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 set ft=make
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 " Perl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 elseif s:name =~ 'perl'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 set ft=perl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 " PHP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 elseif s:name =~ 'php'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 set ft=php
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 " Python
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 elseif s:name =~ 'python'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 set ft=python
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 " Groovy
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 elseif s:name =~ '^groovy\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 set ft=groovy
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 " Ruby
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 elseif s:name =~ 'ruby'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 set ft=ruby
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 " BC calculator
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 elseif s:name =~ '^bc\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 set ft=bc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 " sed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 elseif s:name =~ 'sed\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 set ft=sed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 " OCaml-scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 elseif s:name =~ 'ocaml'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 set ft=ocaml
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 " Awk scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 elseif s:name =~ 'awk\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 set ft=awk
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 " Website MetaLanguage
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 elseif s:name =~ 'wml'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 set ft=wml
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 " Scheme scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 elseif s:name =~ 'scheme'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 set ft=scheme
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 unlet s:name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 " File does not start with "#!".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 let s:line2 = getline(2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 let s:line3 = getline(3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 let s:line4 = getline(4)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 let s:line5 = getline(5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 " Bourne-like shell scripts: sh ksh bash bash2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 if s:line1 =~ '^:$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 call SetFileTypeSH(s:line1) " defined in filetype.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 " Z shell scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 elseif s:line1 =~ '^#compdef\>' || s:line1 =~ '^#autoload\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 set ft=zsh
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 " ELM Mail files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 elseif s:line1 =~ '^From [a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\= .*[12][09]\d\d$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 set ft=mail
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 " Mason
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 elseif s:line1 =~ '^<[%&].*>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 set ft=mason
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 " Vim scripts (must have '" vim' as the first line to trigger this)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 elseif s:line1 =~ '^" *[vV]im$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 set ft=vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 " MOO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 elseif s:line1 =~ '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 set ft=moo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 " Diff file:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 " - "diff" in first line (context diff)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 " - "Only in " in first line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 " - "--- " in first line and "+++ " in second line (unified diff).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 " - "*** " in first line and "--- " in second line (context diff).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 " - "# It was generated by makepatch " in the second line (makepatch diff).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 " - "Index: <filename>" in the first line (CVS file)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 elseif s:line1 =~ '^\(diff\>\|Only in \|\d\+\(,\d\+\)\=[cda]\d\+\>\|# It was generated by makepatch \|Index:\s\+\f\+$\|===== \f\+ \d\+\.\d\+ vs edited\|==== //\f\+#\d\+\)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 \ || (s:line1 =~ '^--- ' && s:line2 =~ '^+++ ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 \ || (s:line1 =~ '^\*\*\* ' && s:line2 =~ '^--- ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 set ft=diff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 " PostScript Files (must have %!PS as the first line, like a2ps output)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 elseif s:line1 =~ '^%![ \t]*PS'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 set ft=postscr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 " M4 scripts: Guess there is a line that starts with "dnl".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 elseif s:line1 =~ '^\s*dnl\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 \ || s:line2 =~ '^\s*dnl\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 \ || s:line3 =~ '^\s*dnl\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 \ || s:line4 =~ '^\s*dnl\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 \ || s:line5 =~ '^\s*dnl\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 set ft=m4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 " AmigaDos scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 elseif $TERM == "amiga"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 \ && (s:line1 =~ "^;" || s:line1 =~ '^\.[bB][rR][aA]')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 set ft=amiga
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 " SiCAD scripts (must have procn or procd as the first line to trigger this)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 elseif s:line1 =~? '^ *proc[nd] *$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 set ft=sicad
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 " Purify log files start with "**** Purify"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 elseif s:line1 =~ '^\*\*\*\* Purify'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 set ft=purifylog
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 " XML
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 elseif s:line1 =~ '<?\s*xml.*?>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 set ft=xml
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 " XHTML (e.g.: PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 elseif s:line1 =~ '\<DTD\s\+XHTML\s'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 set ft=xhtml
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 " XXD output
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 elseif s:line1 =~ '^\x\{7}: \x\{2} \=\x\{2} \=\x\{2} \=\x\{2} '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 set ft=xxd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 " RCS/CVS log output
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 elseif s:line1 =~ '^RCS file:' || s:line2 =~ '^RCS file:'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 set ft=rcslog
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 " CVS commit
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
222 elseif s:line2 =~ '^CVS:' || getline("$") =~ '^CVS: '
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 set ft=cvs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 " Send-pr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 elseif s:line1 =~ '^SEND-PR:'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 set ft=sendpr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 " SNNS files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 elseif s:line1 =~ '^SNNS network definition file'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 set ft=snnsnet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 elseif s:line1 =~ '^SNNS pattern definition file'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 set ft=snnspat
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 elseif s:line1 =~ '^SNNS result file'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 set ft=snnsres
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 " Virata
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 elseif s:line1 =~ '^%.\{-}[Vv]irata'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 \ || s:line2 =~ '^%.\{-}[Vv]irata'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 \ || s:line3 =~ '^%.\{-}[Vv]irata'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 \ || s:line4 =~ '^%.\{-}[Vv]irata'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 \ || s:line5 =~ '^%.\{-}[Vv]irata'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 set ft=virata
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 " Strace
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 elseif s:line1 =~ '^[0-9]* *execve('
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 set ft=strace
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 " VSE JCL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 elseif s:line1 =~ '^\* $$ JOB\>' || s:line1 =~ '^// *JOB\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 set ft=vsejcl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 " TAK and SINDA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 elseif s:line4 =~ 'K & K Associates' || s:line2 =~ 'TAK 2000'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 set ft=takout
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 elseif s:line3 =~ 'S Y S T E M S I M P R O V E D '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 set ft=sindaout
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 elseif getline(6) =~ 'Run Date: '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 set ft=takcmp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 elseif getline(9) =~ 'Node File 1'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 set ft=sindacmp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 " DNS zone files
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 elseif s:line1.s:line2 =~ '$ORIGIN\|$TTL\|IN\s*SOA'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 \ || s:line1.s:line2.s:line3.s:line4 =~ 'BIND.*named'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 set ft=dns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 " BAAN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 elseif s:line1 =~ '|\*\{1,80}' && s:line2 =~ 'VRC '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 \ || s:line2 =~ '|\*\{1,80}' && s:line3 =~ 'VRC '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 set ft=baan
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 " Valgrind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 elseif s:line1 =~ '^==\d\+== valgrind'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 set ft=valgrind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 " Renderman Interface Bytestream
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 elseif s:line1 =~ '^##RenderMan'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 set ft=rib
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 " Scheme scripts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 elseif s:line1 =~ 'exec\s\+\S*scheme' || s:line2 =~ 'exec\s\+\S*scheme'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 set ft=scheme
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 " CVS diff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 let lnum = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 while getline(lnum) =~ "^? " && lnum < line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 let lnum = lnum + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 if getline(lnum) =~ '^Index:\s\+\f\+$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 set ft=diff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 " locale input files: Formal Definitions of Cultural Conventions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 " filename must be like en_US, fr_FR@euro or en_US.UTF-8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 elseif expand("%") =~ '\a\a_\a\a\($\|[.@]\)\|i18n$\|POSIX$\|translit_'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 let lnum = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 while lnum < 100 && lnum < line("$")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 if getline(lnum) =~ '^LC_\(IDENTIFICATION\|CTYPE\|COLLATE\|MONETARY\|NUMERIC\|TIME\|MESSAGES\|PAPER\|TELEPHONE\|MEASUREMENT\|NAME\|ADDRESS\)$'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 setf fdcc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 break
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 let lnum = lnum + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 endwhile
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 unlet s:line2 s:line3 s:line4 s:line5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 " Restore 'cpoptions'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 let &cpo = s:cpo_save
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 unlet s:cpo_save s:line1