7
|
1 " Vim support file to detect file types
|
|
2 "
|
|
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
|
1668
|
4 " Last Change: 2008 Jul 08
|
7
|
5
|
|
6 " Listen very carefully, I will say this only once
|
|
7 if exists("did_load_filetypes")
|
|
8 finish
|
|
9 endif
|
|
10 let did_load_filetypes = 1
|
|
11
|
|
12 " Line continuation is used here, remove 'C' from 'cpoptions'
|
|
13 let s:cpo_save = &cpo
|
|
14 set cpo&vim
|
|
15
|
|
16 augroup filetypedetect
|
|
17
|
|
18 " Ignored extensions
|
1586
|
19 if exists("*fnameescape")
|
1668
|
20 au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.rpmsave,?\+.rpmnew
|
1586
|
21 \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r"))
|
7
|
22 au BufNewFile,BufRead *~
|
|
23 \ let s:name = expand("<afile>") |
|
|
24 \ let s:short = substitute(s:name, '\~$', '', '') |
|
|
25 \ if s:name != s:short && s:short != "" |
|
1586
|
26 \ exe "doau filetypedetect BufRead " . fnameescape(s:short) |
|
7
|
27 \ endif |
|
1586
|
28 \ unlet s:name s:short
|
532
|
29 au BufNewFile,BufRead ?\+.in
|
7
|
30 \ if expand("<afile>:t") != "configure.in" |
|
1586
|
31 \ exe "doau filetypedetect BufRead " . fnameescape(expand("<afile>:r")) |
|
7
|
32 \ endif
|
1586
|
33 elseif &verbose > 0
|
|
34 echomsg "Warning: some filetypes will not be recognized because this version of Vim does not have fnameescape()"
|
|
35 endif
|
7
|
36
|
|
37 " Pattern used to match file names which should not be inspected.
|
|
38 " Currently finds compressed files.
|
|
39 if !exists("g:ft_ignore_pat")
|
|
40 let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
|
|
41 endif
|
|
42
|
216
|
43 " Function used for patterns that end in a star: don't set the filetype if the
|
|
44 " file name matches ft_ignore_pat.
|
1219
|
45 func! s:StarSetf(ft)
|
216
|
46 if expand("<amatch>") !~ g:ft_ignore_pat
|
|
47 exe 'setf ' . a:ft
|
|
48 endif
|
1219
|
49 endfunc
|
216
|
50
|
7
|
51 " Abaqus or Trasys
|
216
|
52 au BufNewFile,BufRead *.inp call s:Check_inp()
|
7
|
53
|
1219
|
54 func! s:Check_inp()
|
7
|
55 if getline(1) =~ '^\*'
|
|
56 setf abaqus
|
|
57 else
|
|
58 let n = 1
|
|
59 if line("$") > 500
|
|
60 let nmax = 500
|
|
61 else
|
|
62 let nmax = line("$")
|
|
63 endif
|
|
64 while n <= nmax
|
|
65 if getline(n) =~? "^header surface data"
|
|
66 setf trasys
|
|
67 break
|
|
68 endif
|
|
69 let n = n + 1
|
|
70 endwhile
|
|
71 endif
|
1219
|
72 endfunc
|
7
|
73
|
|
74 " A-A-P recipe
|
|
75 au BufNewFile,BufRead *.aap setf aap
|
|
76
|
389
|
77 " A2ps printing utility
|
|
78 au BufNewFile,BufRead etc/a2ps.cfg,etc/a2ps/*.cfg,a2psrc,.a2psrc setf a2ps
|
|
79
|
22
|
80 " ABAB/4
|
|
81 au BufNewFile,BufRead *.abap setf abap
|
|
82
|
7
|
83 " ABC music notation
|
|
84 au BufNewFile,BufRead *.abc setf abc
|
|
85
|
|
86 " ABEL
|
|
87 au BufNewFile,BufRead *.abl setf abel
|
|
88
|
|
89 " AceDB
|
|
90 au BufNewFile,BufRead *.wrm setf acedb
|
|
91
|
|
92 " Ada (83, 9X, 95)
|
|
93 au BufNewFile,BufRead *.adb,*.ads,*.ada setf ada
|
1125
|
94 if has("vms")
|
|
95 au BufNewFile,BufRead *.gpr,*.ada_m,*.adc setf ada
|
|
96 else
|
|
97 au BufNewFile,BufRead *.gpr setf ada
|
|
98 endif
|
7
|
99
|
|
100 " AHDL
|
|
101 au BufNewFile,BufRead *.tdf setf ahdl
|
|
102
|
|
103 " AMPL
|
|
104 au BufNewFile,BufRead *.run setf ampl
|
|
105
|
|
106 " Ant
|
|
107 au BufNewFile,BufRead build.xml setf ant
|
|
108
|
|
109 " Apache style config file
|
216
|
110 au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle')
|
7
|
111
|
|
112 " Apache config file
|
216
|
113 au BufNewFile,BufRead .htaccess setf apache
|
|
114 au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/apache2/*.conf* call s:StarSetf('apache')
|
7
|
115
|
|
116 " XA65 MOS6510 cross assembler
|
|
117 au BufNewFile,BufRead *.a65 setf a65
|
|
118
|
|
119 " Applix ELF
|
|
120 au BufNewFile,BufRead *.am
|
|
121 \ if expand("<afile>") !~? 'Makefile.am\>' | setf elf | endif
|
|
122
|
24
|
123 " ALSA configuration
|
|
124 au BufNewFile,BufRead ~/.asoundrc,/usr/share/alsa/alsa.conf,/etc/asound.conf setf alsaconf
|
|
125
|
7
|
126 " Arc Macro Language
|
|
127 au BufNewFile,BufRead *.aml setf aml
|
|
128
|
|
129 " Arch Inventory file
|
|
130 au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch
|
|
131
|
|
132 " ART*Enterprise (formerly ART-IM)
|
|
133 au BufNewFile,BufRead *.art setf art
|
|
134
|
|
135 " ASN.1
|
|
136 au BufNewFile,BufRead *.asn,*.asn1 setf asn
|
|
137
|
|
138 " Active Server Pages (with Visual Basic Script)
|
|
139 au BufNewFile,BufRead *.asa
|
|
140 \ if exists("g:filetype_asa") |
|
|
141 \ exe "setf " . g:filetype_asa |
|
|
142 \ else |
|
|
143 \ setf aspvbs |
|
|
144 \ endif
|
|
145
|
|
146 " Active Server Pages (with Perl or Visual Basic Script)
|
|
147 au BufNewFile,BufRead *.asp
|
|
148 \ if exists("g:filetype_asp") |
|
|
149 \ exe "setf " . g:filetype_asp |
|
|
150 \ elseif getline(1) . getline(2) . getline(3) =~? "perlscript" |
|
|
151 \ setf aspperl |
|
|
152 \ else |
|
|
153 \ setf aspvbs |
|
|
154 \ endif
|
|
155
|
|
156 " Grub (must be before catch *.lst)
|
819
|
157 au BufNewFile,BufRead /boot/grub/menu.lst,/boot/grub/grub.conf,/etc/grub.conf setf grub
|
7
|
158
|
|
159 " Assembly (all kinds)
|
|
160 " *.lst is not pure assembly, it has two extra columns (address, byte codes)
|
216
|
161 au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call s:FTasm()
|
7
|
162
|
|
163 " This function checks for the kind of assembly that is wanted by the user, or
|
|
164 " can be detected from the first five lines of the file.
|
1219
|
165 func! s:FTasm()
|
7
|
166 " make sure b:asmsyntax exists
|
|
167 if !exists("b:asmsyntax")
|
|
168 let b:asmsyntax = ""
|
|
169 endif
|
|
170
|
|
171 if b:asmsyntax == ""
|
216
|
172 call s:FTasmsyntax()
|
7
|
173 endif
|
|
174
|
|
175 " if b:asmsyntax still isn't set, default to asmsyntax or GNU
|
|
176 if b:asmsyntax == ""
|
|
177 if exists("g:asmsyntax")
|
|
178 let b:asmsyntax = g:asmsyntax
|
|
179 else
|
|
180 let b:asmsyntax = "asm"
|
|
181 endif
|
|
182 endif
|
|
183
|
|
184 exe "setf " . b:asmsyntax
|
1219
|
185 endfunc
|
|
186
|
|
187 func! s:FTasmsyntax()
|
7
|
188 " see if file contains any asmsyntax=foo overrides. If so, change
|
|
189 " b:asmsyntax appropriately
|
|
190 let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4).
|
|
191 \" ".getline(5)." "
|
|
192 if head =~ '\sasmsyntax=\S\+\s'
|
1587
|
193 let b:asmsyntax = substitute(head, '.*\sasmsyntax=\([a-zA-Z0-9]\+\)\s.*','\1', "")
|
7
|
194 elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library'))
|
|
195 let b:asmsyntax = "vmasm"
|
|
196 endif
|
1219
|
197 endfunc
|
7
|
198
|
|
199 " Macro (VAX)
|
|
200 au BufNewFile,BufRead *.mar setf vmasm
|
|
201
|
|
202 " Atlas
|
|
203 au BufNewFile,BufRead *.atl,*.as setf atlas
|
|
204
|
1125
|
205 " Autoit v3
|
|
206 au BufNewFile,BufRead *.au3 setf autoit
|
|
207
|
1219
|
208 " Autohotkey
|
|
209 au BufNewFile,BufRead *.ahk setf autohotkey
|
|
210
|
7
|
211 " Automake
|
809
|
212 au BufNewFile,BufRead [mM]akefile.am,GNUmakefile.am setf automake
|
7
|
213
|
375
|
214 " Autotest .at files are actually m4
|
|
215 au BufNewFile,BufRead *.at setf m4
|
|
216
|
7
|
217 " Avenue
|
|
218 au BufNewFile,BufRead *.ave setf ave
|
|
219
|
|
220 " Awk
|
|
221 au BufNewFile,BufRead *.awk setf awk
|
|
222
|
|
223 " B
|
|
224 au BufNewFile,BufRead *.mch,*.ref,*.imp setf b
|
|
225
|
|
226 " BASIC or Visual Basic
|
216
|
227 au BufNewFile,BufRead *.bas call s:FTVB("basic")
|
7
|
228
|
|
229 " Check if one of the first five lines contains "VB_Name". In that case it is
|
|
230 " probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype.
|
1219
|
231 func! s:FTVB(alt)
|
7
|
232 if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
|
|
233 setf vb
|
|
234 else
|
|
235 exe "setf " . a:alt
|
|
236 endif
|
1219
|
237 endfunc
|
7
|
238
|
|
239 " Visual Basic Script (close to Visual Basic)
|
|
240 au BufNewFile,BufRead *.vbs,*.dsm,*.ctl setf vb
|
|
241
|
1125
|
242 " IBasic file (similar to QBasic)
|
|
243 au BufNewFile,BufRead *.iba,*.ibi setf ibasic
|
|
244
|
|
245 " FreeBasic file (similar to QBasic)
|
|
246 au BufNewFile,BufRead *.fb,*.bi setf freebasic
|
|
247
|
7
|
248 " Batch file for MSDOS.
|
15
|
249 au BufNewFile,BufRead *.bat,*.sys setf dosbatch
|
7
|
250 " *.cmd is close to a Batch file, but on OS/2 Rexx files also use *.cmd.
|
|
251 au BufNewFile,BufRead *.cmd
|
|
252 \ if getline(1) =~ '^/\*' | setf rexx | else | setf dosbatch | endif
|
|
253
|
|
254 " Batch file for 4DOS
|
216
|
255 au BufNewFile,BufRead *.btm call s:FTbtm()
|
1219
|
256 func! s:FTbtm()
|
15
|
257 if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm
|
|
258 setf dosbatch
|
|
259 else
|
|
260 setf btm
|
|
261 endif
|
1219
|
262 endfunc
|
7
|
263
|
|
264 " BC calculator
|
|
265 au BufNewFile,BufRead *.bc setf bc
|
|
266
|
|
267 " BDF font
|
|
268 au BufNewFile,BufRead *.bdf setf bdf
|
|
269
|
|
270 " BibTeX bibliography database file
|
|
271 au BufNewFile,BufRead *.bib setf bib
|
|
272
|
846
|
273 " BibTeX Bibliography Style
|
|
274 au BufNewFile,BufRead *.bst setf bst
|
|
275
|
7
|
276 " BIND configuration
|
45
|
277 au BufNewFile,BufRead named.conf,rndc.conf setf named
|
7
|
278
|
|
279 " BIND zone
|
|
280 au BufNewFile,BufRead named.root setf bindzone
|
805
|
281 au BufNewFile,BufRead *.db call s:BindzoneCheck('')
|
|
282
|
|
283 func! s:BindzoneCheck(default)
|
|
284 if getline(1).getline(2).getline(3).getline(4) =~ '^; <<>> DiG [0-9.]\+ <<>>\|BIND.*named\|$ORIGIN\|$TTL\|IN\s\+SOA'
|
|
285 setf bindzone
|
|
286 elseif a:default != ''
|
|
287 exe 'setf ' . a:default
|
|
288 endif
|
|
289 endfunc
|
7
|
290
|
|
291 " Blank
|
|
292 au BufNewFile,BufRead *.bl setf blank
|
|
293
|
|
294 " C or lpc
|
216
|
295 au BufNewFile,BufRead *.c call s:FTlpc()
|
7
|
296
|
1219
|
297 func! s:FTlpc()
|
7
|
298 if exists("g:lpc_syntax_for_c")
|
|
299 let lnum = 1
|
|
300 while lnum <= 12
|
|
301 if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)'
|
|
302 setf lpc
|
|
303 return
|
|
304 endif
|
|
305 let lnum = lnum + 1
|
|
306 endwhile
|
|
307 endif
|
|
308 setf c
|
1219
|
309 endfunc
|
7
|
310
|
|
311 " Calendar
|
216
|
312 au BufNewFile,BufRead calendar setf calendar
|
|
313 au BufNewFile,BufRead */.calendar/*,
|
7
|
314 \*/share/calendar/*/calendar.*,*/share/calendar/calendar.*
|
216
|
315 \ call s:StarSetf('calendar')
|
7
|
316
|
|
317 " C#
|
|
318 au BufNewFile,BufRead *.cs setf cs
|
|
319
|
1219
|
320 " Cdrdao TOC
|
|
321 au BufNewFile,BufRead *.toc setf cdrtoc
|
|
322
|
1648
|
323 " Cdrdao config
|
|
324 au BufNewFile,BufRead etc/cdrdao.conf,etc/defaults/cdrdao,etc/default/cdrdao,~/.cdrdao setf cdrdaoconf
|
|
325
|
555
|
326 " Cfengine
|
|
327 au BufNewFile,BufRead cfengine.conf setf cfengine
|
|
328
|
7
|
329 " Comshare Dimension Definition Language
|
|
330 au BufNewFile,BufRead *.cdl setf cdl
|
|
331
|
1125
|
332 " Conary Recipe
|
|
333 au BufNewFile,BufRead *.recipe setf conaryrecipe
|
|
334
|
7
|
335 " Controllable Regex Mutilator
|
|
336 au BufNewFile,BufRead *.crm setf crm
|
|
337
|
|
338 " Cyn++
|
|
339 au BufNewFile,BufRead *.cyn setf cynpp
|
|
340
|
|
341 " Cynlib
|
|
342 " .cc and .cpp files can be C++ or Cynlib.
|
|
343 au BufNewFile,BufRead *.cc
|
|
344 \ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cpp|endif
|
|
345 au BufNewFile,BufRead *.cpp
|
|
346 \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif
|
|
347
|
|
348 " C++
|
|
349 if has("fname_case")
|
|
350 au BufNewFile,BufRead *.cxx,*.c++,*.C,*.H,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp
|
|
351 else
|
|
352 au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp
|
|
353 endif
|
|
354
|
1648
|
355 " .h files can be C, Ch C++, ObjC or ObjC++.
|
|
356 " Set c_syntax_for_h if you want C, ch_syntax_for_h if you want Ch. ObjC is
|
|
357 " detected automatically.
|
|
358 au BufNewFile,BufRead *.h call s:FTheader()
|
|
359
|
|
360 func! s:FTheader()
|
|
361 if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1
|
|
362 setf objc
|
|
363 elseif exists("c_syntax_for_h")
|
|
364 setf c
|
|
365 elseif exists("ch_syntax_for_h")
|
|
366 setf ch
|
|
367 else
|
|
368 setf cpp
|
|
369 endif
|
|
370 endfunc
|
7
|
371
|
|
372 " Ch (CHscript)
|
|
373 au BufNewFile,BufRead *.chf setf ch
|
|
374
|
|
375 " TLH files are C++ headers generated by Visual C++'s #import from typelibs
|
|
376 au BufNewFile,BufRead *.tlh setf cpp
|
|
377
|
|
378 " Cascading Style Sheets
|
|
379 au BufNewFile,BufRead *.css setf css
|
|
380
|
|
381 " Century Term Command Scripts (*.cmd too)
|
|
382 au BufNewFile,BufRead *.con setf cterm
|
|
383
|
|
384 " Changelog
|
809
|
385 au BufNewFile,BufRead changelog.Debian,changelog.dch,NEWS.Debian,NEWS.dch
|
|
386 \ setf debchangelog
|
|
387
|
|
388 au BufNewFile,BufRead [cC]hange[lL]og
|
|
389 \ if getline(1) =~ '; urgency='
|
|
390 \| setf debchangelog
|
|
391 \| else
|
|
392 \| setf changelog
|
|
393 \| endif
|
|
394
|
|
395 au BufNewFile,BufRead NEWS
|
|
396 \ if getline(1) =~ '; urgency='
|
|
397 \| setf debchangelog
|
|
398 \| endif
|
7
|
399
|
|
400 " CHILL
|
|
401 au BufNewFile,BufRead *..ch setf chill
|
|
402
|
|
403 " Changes for WEB and CWEB or CHILL
|
216
|
404 au BufNewFile,BufRead *.ch call s:FTchange()
|
7
|
405
|
|
406 " This function checks if one of the first ten lines start with a '@'. In
|
|
407 " that case it is probably a change file.
|
|
408 " If the first line starts with # or ! it's probably a ch file.
|
|
409 " If a line has "main", "include", "//" ir "/*" it's probably ch.
|
|
410 " Otherwise CHILL is assumed.
|
1219
|
411 func! s:FTchange()
|
7
|
412 let lnum = 1
|
|
413 while lnum <= 10
|
|
414 if getline(lnum)[0] == '@'
|
|
415 setf change
|
|
416 return
|
|
417 endif
|
|
418 if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!')
|
|
419 setf ch
|
|
420 return
|
|
421 endif
|
|
422 if getline(lnum) =~ "MODULE"
|
|
423 setf chill
|
|
424 return
|
|
425 endif
|
|
426 if getline(lnum) =~ 'main\s*(\|#\s*include\|//'
|
|
427 setf ch
|
|
428 return
|
|
429 endif
|
|
430 let lnum = lnum + 1
|
|
431 endwhile
|
|
432 setf chill
|
1219
|
433 endfunc
|
7
|
434
|
839
|
435 " ChordPro
|
|
436 au BufNewFile,BufRead *.chopro,*.crd,*.cho,*.crdpro,*.chordpro setf chordpro
|
|
437
|
7
|
438 " Clean
|
|
439 au BufNewFile,BufRead *.dcl,*.icl setf clean
|
|
440
|
|
441 " Clever
|
|
442 au BufNewFile,BufRead *.eni setf cl
|
|
443
|
|
444 " Clever or dtd
|
216
|
445 au BufNewFile,BufRead *.ent call s:FTent()
|
7
|
446
|
1219
|
447 func! s:FTent()
|
7
|
448 " This function checks for valid cl syntax in the first five lines.
|
|
449 " Look for either an opening comment, '#', or a block start, '{".
|
|
450 " If not found, assume SGML.
|
|
451 let lnum = 1
|
|
452 while lnum < 6
|
|
453 let line = getline(lnum)
|
|
454 if line =~ '^\s*[#{]'
|
|
455 setf cl
|
|
456 return
|
|
457 elseif line !~ '^\s*$'
|
|
458 " Not a blank line, not a comment, and not a block start,
|
|
459 " so doesn't look like valid cl code.
|
|
460 break
|
|
461 endif
|
|
462 let lnum = lnum + 1
|
|
463 endw
|
|
464 setf dtd
|
1219
|
465 endfunc
|
7
|
466
|
625
|
467 " Clipper (or FoxPro; could also be eviews)
|
7
|
468 au BufNewFile,BufRead *.prg
|
|
469 \ if exists("g:filetype_prg") |
|
|
470 \ exe "setf " . g:filetype_prg |
|
|
471 \ else |
|
|
472 \ setf clipper |
|
|
473 \ endif
|
|
474
|
836
|
475 " Cmake
|
|
476 au BufNewFile,BufRead CMakeLists.txt,*.cmake,*.cmake.in setf cmake
|
|
477
|
1125
|
478 " Cmusrc
|
|
479 au BufNewFile,BufRead ~/.cmus/{autosave,rc,command-history,*.theme} setf cmusrc
|
|
480 au BufNewFile,BufRead */cmus/{rc,*.theme} setf cmusrc
|
|
481
|
7
|
482 " Cobol
|
809
|
483 au BufNewFile,BufRead *.cbl,*.cob,*.lib setf cobol
|
|
484 " cobol or zope form controller python script? (heuristic)
|
|
485 au BufNewFile,BufRead *.cpy
|
|
486 \ if getline(1) =~ '^##' |
|
|
487 \ setf python |
|
|
488 \ else |
|
|
489 \ setf cobol |
|
|
490 \ endif
|
7
|
491
|
1648
|
492 " Coco/R
|
|
493 au BufNewFile,BufRead *.atg setf coco
|
|
494
|
7
|
495 " Cold Fusion
|
|
496 au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf
|
|
497
|
|
498 " Configure scripts
|
|
499 au BufNewFile,BufRead configure.in,configure.ac setf config
|
|
500
|
1648
|
501 " CUDA Cumpute Unified Device Architecture
|
|
502 au BufNewFile,BufRead *.cu setf cuda
|
|
503
|
7
|
504 " WildPackets EtherPeek Decoder
|
|
505 au BufNewFile,BufRead *.dcd setf dcd
|
|
506
|
|
507 " Enlightenment configuration files
|
|
508 au BufNewFile,BufRead *enlightenment/*.cfg setf c
|
|
509
|
|
510 " Eterm
|
|
511 au BufNewFile,BufRead *Eterm/*.cfg setf eterm
|
|
512
|
|
513 " Lynx config files
|
|
514 au BufNewFile,BufRead lynx.cfg setf lynx
|
|
515
|
|
516 " Quake
|
|
517 au BufNewFile,BufRead *baseq[2-3]/*.cfg,*id1/*.cfg setf quake
|
|
518 au BufNewFile,BufRead *quake[1-3]/*.cfg setf quake
|
|
519
|
|
520 " Quake C
|
|
521 au BufNewFile,BufRead *.qc setf c
|
|
522
|
|
523 " Configure files
|
|
524 au BufNewFile,BufRead *.cfg setf cfg
|
|
525
|
|
526 " Communicating Sequential Processes
|
|
527 au BufNewFile,BufRead *.csp,*.fdr setf csp
|
|
528
|
|
529 " CUPL logic description and simulation
|
|
530 au BufNewFile,BufRead *.pld setf cupl
|
|
531 au BufNewFile,BufRead *.si setf cuplsim
|
|
532
|
|
533 " Debian Control
|
|
534 au BufNewFile,BufRead */debian/control setf debcontrol
|
1648
|
535 au BufNewFile,BufRead control
|
|
536 \ if getline(1) =~ '^Source:'
|
|
537 \| setf debcontrol
|
|
538 \| endif
|
7
|
539
|
816
|
540 " Debian Sources.list
|
|
541 au BufNewFile,BufRead /etc/apt/sources.list setf debsources
|
|
542
|
1648
|
543 " Deny hosts
|
|
544 au BufNewFile,BufRead denyhosts.conf setf denyhosts
|
|
545
|
7
|
546 " ROCKLinux package description
|
|
547 au BufNewFile,BufRead *.desc setf desc
|
|
548
|
1648
|
549 " the D language or dtrace
|
|
550 au BufNewFile,BufRead *.d call s:DtraceCheck()
|
|
551
|
|
552 func! s:DtraceCheck()
|
|
553 let lines = getline(1, min([line("$"), 100]))
|
|
554 if match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1
|
|
555 setf dtrace
|
|
556 else
|
|
557 setf d
|
|
558 endif
|
|
559 endfunc
|
7
|
560
|
|
561 " Desktop files
|
|
562 au BufNewFile,BufRead *.desktop,.directory setf desktop
|
|
563
|
389
|
564 " Dict config
|
|
565 au BufNewFile,BufRead dict.conf,.dictrc setf dictconf
|
|
566
|
|
567 " Dictd config
|
|
568 au BufNewFile,BufRead dictd.conf setf dictdconf
|
|
569
|
7
|
570 " Diff files
|
|
571 au BufNewFile,BufRead *.diff,*.rej,*.patch setf diff
|
|
572
|
|
573 " Dircolors
|
|
574 au BufNewFile,BufRead .dir_colors,/etc/DIR_COLORS setf dircolors
|
|
575
|
|
576 " Diva (with Skill) or InstallShield
|
|
577 au BufNewFile,BufRead *.rul
|
|
578 \ if getline(1).getline(2).getline(3).getline(4).getline(5).getline(6) =~? 'InstallShield' |
|
|
579 \ setf ishd |
|
|
580 \ else |
|
|
581 \ setf diva |
|
|
582 \ endif
|
|
583
|
|
584 " DCL (Digital Command Language - vms) or DNS zone file
|
805
|
585 au BufNewFile,BufRead *.com call s:BindzoneCheck('dcl')
|
7
|
586
|
|
587 " DOT
|
|
588 au BufNewFile,BufRead *.dot setf dot
|
|
589
|
|
590 " Dylan - lid files
|
|
591 au BufNewFile,BufRead *.lid setf dylanlid
|
|
592
|
|
593 " Dylan - intr files (melange)
|
|
594 au BufNewFile,BufRead *.intr setf dylanintr
|
|
595
|
|
596 " Dylan
|
|
597 au BufNewFile,BufRead *.dylan setf dylan
|
|
598
|
|
599 " Microsoft Module Definition
|
|
600 au BufNewFile,BufRead *.def setf def
|
|
601
|
|
602 " Dracula
|
|
603 au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula
|
|
604
|
|
605 " dsl
|
|
606 au BufNewFile,BufRead *.dsl setf dsl
|
|
607
|
|
608 " DTD (Document Type Definition for XML)
|
|
609 au BufNewFile,BufRead *.dtd setf dtd
|
|
610
|
|
611 " EDIF (*.edf,*.edif,*.edn,*.edo)
|
|
612 au BufNewFile,BufRead *.ed\(f\|if\|n\|o\) setf edif
|
|
613
|
|
614 " Embedix Component Description
|
|
615 au BufNewFile,BufRead *.ecd setf ecd
|
|
616
|
|
617 " Eiffel or Specman
|
216
|
618 au BufNewFile,BufRead *.e,*.E call s:FTe()
|
7
|
619
|
|
620 " Elinks configuration
|
|
621 au BufNewFile,BufRead */etc/elinks.conf,*/.elinks/elinks.conf setf elinks
|
|
622
|
1219
|
623 func! s:FTe()
|
7
|
624 let n = 1
|
|
625 while n < 100 && n < line("$")
|
|
626 if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
|
|
627 setf specman
|
|
628 return
|
|
629 endif
|
|
630 let n = n + 1
|
|
631 endwhile
|
|
632 setf eiffel
|
1219
|
633 endfunc
|
7
|
634
|
1648
|
635 " ERicsson LANGuage; Yaws is erlang too
|
1668
|
636 au BufNewFile,BufRead *.erl,*.hrl,*.yaws setf erlang
|
7
|
637
|
|
638 " Elm Filter Rules file
|
|
639 au BufNewFile,BufRead filter-rules setf elmfilt
|
|
640
|
168
|
641 " ESMTP rc file
|
|
642 au BufNewFile,BufRead *esmtprc setf esmtprc
|
|
643
|
7
|
644 " ESQL-C
|
|
645 au BufNewFile,BufRead *.ec,*.EC setf esqlc
|
|
646
|
278
|
647 " Esterel
|
|
648 au BufNewFile,BufRead *.strl setf esterel
|
|
649
|
7
|
650 " Essbase script
|
|
651 au BufNewFile,BufRead *.csc setf csc
|
|
652
|
|
653 " Exim
|
|
654 au BufNewFile,BufRead exim.conf setf exim
|
|
655
|
|
656 " Expect
|
|
657 au BufNewFile,BufRead *.exp setf expect
|
|
658
|
|
659 " Exports
|
|
660 au BufNewFile,BufRead exports setf exports
|
|
661
|
333
|
662 " Factor
|
|
663 au BufNewFile,BufRead *.factor setf factor
|
|
664
|
7
|
665 " Fetchmail RC file
|
|
666 au BufNewFile,BufRead .fetchmailrc setf fetchmail
|
|
667
|
846
|
668 " FlexWiki
|
|
669 au BufNewFile,BufRead *.wiki setf flexwiki
|
|
670
|
7
|
671 " Focus Executable
|
|
672 au BufNewFile,BufRead *.fex,*.focexec setf focexec
|
|
673
|
|
674 " Focus Master file (but not for auto.master)
|
|
675 au BufNewFile,BufRead auto.master setf conf
|
|
676 au BufNewFile,BufRead *.mas,*.master setf master
|
|
677
|
|
678 " Forth
|
|
679 au BufNewFile,BufRead *.fs,*.ft setf forth
|
|
680
|
1648
|
681 " Reva Forth
|
|
682 au BufNewFile,BufRead *.frt setf reva
|
|
683
|
7
|
684 " Fortran
|
1125
|
685 if has("fname_case")
|
|
686 au BufNewFile,BufRead *.F,*.FOR,*.FPP,*.FTN,*.F77,*.F90,*.F95 setf fortran
|
|
687 endif
|
1648
|
688 au BufNewFile,BufRead *.f,*.for,*.fortran,*.fpp,*.ftn,*.f77,*.f90,*.f95 setf fortran
|
7
|
689
|
|
690 " FStab
|
819
|
691 au BufNewFile,BufRead fstab,mtab setf fstab
|
7
|
692
|
|
693 " GDB command files
|
|
694 au BufNewFile,BufRead .gdbinit setf gdb
|
|
695
|
|
696 " GDMO
|
|
697 au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
|
|
698
|
|
699 " Gedcom
|
|
700 au BufNewFile,BufRead *.ged setf gedcom
|
|
701
|
1648
|
702 " Git
|
|
703 autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit
|
|
704 autocmd BufNewFile,BufRead *.git/config,.gitconfig setf gitconfig
|
|
705 autocmd BufNewFile,BufRead git-rebase-todo setf gitrebase
|
|
706 autocmd BufNewFile,BufRead .msg.[0-9]*
|
|
707 \ if getline(1) =~ '^From.*# This line is ignored.$' |
|
|
708 \ setf gitsendemail |
|
|
709 \ endif
|
|
710 autocmd BufNewFile,BufRead *.git/**
|
|
711 \ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
|
|
712 \ setf git |
|
|
713 \ endif
|
|
714
|
7
|
715 " Gkrellmrc
|
|
716 au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc
|
|
717
|
|
718 " GP scripts (2.0 and onward)
|
827
|
719 au BufNewFile,BufRead *.gp,.gprc setf gp
|
7
|
720
|
|
721 " GPG
|
|
722 au BufNewFile,BufRead */.gnupg/options setf gpg
|
|
723 au BufNewFile,BufRead */.gnupg/gpg.conf setf gpg
|
|
724 au BufNewFile,BufRead /usr/**/gnupg/options.skel setf gpg
|
|
725
|
|
726 " Gnuplot scripts
|
|
727 au BufNewFile,BufRead *.gpi setf gnuplot
|
|
728
|
|
729 " GrADS scripts
|
|
730 au BufNewFile,BufRead *.gs setf grads
|
|
731
|
625
|
732 " Gretl
|
|
733 au BufNewFile,BufRead *.gretl setf gretl
|
|
734
|
7
|
735 " Groovy
|
|
736 au BufNewFile,BufRead *.groovy setf groovy
|
|
737
|
|
738 " GNU Server Pages
|
|
739 au BufNewFile,BufRead *.gsp setf gsp
|
|
740
|
389
|
741 " Group file
|
1668
|
742 au BufNewFile,BufRead /etc/group,/etc/group-,/etc/group.edit,/etc/gshadow,/etc/gshadow-,/etc/gshadow.edit,/var/backups/group.bak,/var/backups/gshadow.bak setf group
|
389
|
743
|
7
|
744 " GTK RC
|
|
745 au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc
|
|
746
|
1668
|
747 " Haml
|
|
748 au BufNewFile,BufRead *.haml setf haml
|
|
749
|
1125
|
750 " Hamster Classic | Playground files
|
|
751 au BufNewFile,BufRead *.hsc,*.hsm setf hamster
|
|
752
|
7
|
753 " Haskell
|
|
754 au BufNewFile,BufRead *.hs setf haskell
|
|
755 au BufNewFile,BufRead *.lhs setf lhaskell
|
|
756 au BufNewFile,BufRead *.chs setf chaskell
|
|
757
|
1648
|
758 " Haste
|
|
759 au BufNewFile,BufRead *.ht setf haste
|
1668
|
760 au BufNewFile,BufRead *.htpp setf hastepreproc
|
1648
|
761
|
7
|
762 " Hercules
|
|
763 au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules
|
|
764
|
|
765 " HEX (Intel)
|
|
766 au BufNewFile,BufRead *.hex,*.h32 setf hex
|
|
767
|
|
768 " Tilde (must be before HTML)
|
|
769 au BufNewFile,BufRead *.t.html setf tilde
|
|
770
|
497
|
771 " HTML (.shtml and .stm for server side)
|
|
772 au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call s:FThtml()
|
7
|
773
|
798
|
774 " Distinguish between HTML, XHTML and Django
|
1219
|
775 func! s:FThtml()
|
7
|
776 let n = 1
|
|
777 while n < 10 && n < line("$")
|
|
778 if getline(n) =~ '\<DTD\s\+XHTML\s'
|
|
779 setf xhtml
|
|
780 return
|
|
781 endif
|
798
|
782 if getline(n) =~ '{%\s*\(extends\|block\)\>'
|
|
783 setf htmldjango
|
|
784 return
|
|
785 endif
|
7
|
786 let n = n + 1
|
|
787 endwhile
|
|
788 setf html
|
1219
|
789 endfunc
|
7
|
790
|
497
|
791 " HTML with Ruby - eRuby
|
1219
|
792 au BufNewFile,BufRead *.erb,*.rhtml setf eruby
|
7
|
793
|
|
794 " HTML with M4
|
|
795 au BufNewFile,BufRead *.html.m4 setf htmlm4
|
|
796
|
|
797 " HTML Cheetah template
|
|
798 au BufNewFile,BufRead *.tmpl setf htmlcheetah
|
|
799
|
1648
|
800 " Host config
|
|
801 au BufNewFile,BufRead /etc/host.conf setf hostconf
|
|
802
|
7
|
803 " Hyper Builder
|
|
804 au BufNewFile,BufRead *.hb setf hb
|
|
805
|
|
806 " Icon
|
|
807 au BufNewFile,BufRead *.icn setf icon
|
|
808
|
|
809 " IDL (Interface Description Language)
|
216
|
810 au BufNewFile,BufRead *.idl call s:FTidl()
|
7
|
811
|
|
812 " Distinguish between standard IDL and MS-IDL
|
1219
|
813 func! s:FTidl()
|
7
|
814 let n = 1
|
|
815 while n < 50 && n < line("$")
|
|
816 if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
|
|
817 setf msidl
|
|
818 return
|
|
819 endif
|
|
820 let n = n + 1
|
|
821 endwhile
|
|
822 setf idl
|
1219
|
823 endfunc
|
7
|
824
|
|
825 " Microsoft IDL (Interface Description Language) Also *.idl
|
|
826 " MOF = WMI (Windows Management Instrumentation) Managed Object Format
|
|
827 au BufNewFile,BufRead *.odl,*.mof setf msidl
|
|
828
|
|
829 " Icewm menu
|
|
830 au BufNewFile,BufRead */.icewm/menu setf icemenu
|
|
831
|
1219
|
832 " Indent profile (must come before IDL *.pro!)
|
|
833 au BufNewFile,BufRead .indent.pro setf indent
|
|
834 au BufNewFile,BufRead indent.pro call s:ProtoCheck('indent')
|
|
835
|
7
|
836 " IDL (Interactive Data Language)
|
1219
|
837 au BufNewFile,BufRead *.pro call s:ProtoCheck('idlang')
|
|
838
|
|
839 " Distinguish between "default" and Cproto prototype file. */
|
|
840 func! s:ProtoCheck(default)
|
|
841 " Cproto files have a comment in the first line and a function prototype in
|
|
842 " the second line, it always ends in ";". Indent files may also have
|
|
843 " comments, thus we can't match comments to see the difference.
|
|
844 if getline(2) =~ ';$'
|
|
845 setf cpp
|
|
846 else
|
|
847 exe 'setf ' . a:default
|
|
848 endif
|
|
849 endfunc
|
|
850
|
7
|
851
|
389
|
852 " Indent RC
|
|
853 au BufNewFile,BufRead indentrc setf indentrc
|
|
854
|
7
|
855 " Inform
|
|
856 au BufNewFile,BufRead *.inf,*.INF setf inform
|
|
857
|
1125
|
858 " Initng
|
|
859 au BufNewFile,BufRead /etc/initng/**/*.i,*.ii setf initng
|
|
860
|
148
|
861 " Ipfilter
|
1125
|
862 au BufNewFile,BufRead ipf.conf,ipf6.conf,ipf.rules setf ipfilter
|
148
|
863
|
7
|
864 " Informix 4GL (source - canonical, include file, I4GL+M4 preproc.)
|
|
865 au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl
|
|
866
|
|
867 " .INI file for MSDOS
|
|
868 au BufNewFile,BufRead *.ini setf dosini
|
|
869
|
|
870 " SysV Inittab
|
|
871 au BufNewFile,BufRead inittab setf inittab
|
|
872
|
|
873 " Inno Setup
|
|
874 au BufNewFile,BufRead *.iss setf iss
|
|
875
|
|
876 " JAL
|
|
877 au BufNewFile,BufRead *.jal,*.JAL setf jal
|
|
878
|
|
879 " Jam
|
|
880 au BufNewFile,BufRead *.jpl,*.jpr setf jam
|
|
881
|
|
882 " Java
|
|
883 au BufNewFile,BufRead *.java,*.jav setf java
|
|
884
|
|
885 " JavaCC
|
|
886 au BufNewFile,BufRead *.jj,*.jjt setf javacc
|
|
887
|
1125
|
888 " JavaScript, ECMAScript
|
|
889 au BufNewFile,BufRead *.js,*.javascript,*.es setf javascript
|
7
|
890
|
|
891 " Java Server Pages
|
|
892 au BufNewFile,BufRead *.jsp setf jsp
|
|
893
|
|
894 " Java Properties resource file (note: doesn't catch font.properties.pl)
|
216
|
895 au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties
|
|
896 au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties')
|
7
|
897
|
|
898 " Jess
|
|
899 au BufNewFile,BufRead *.clp setf jess
|
|
900
|
|
901 " Jgraph
|
|
902 au BufNewFile,BufRead *.jgr setf jgraph
|
|
903
|
|
904 " Kixtart
|
|
905 au BufNewFile,BufRead *.kix setf kix
|
|
906
|
|
907 " Kimwitu[++]
|
|
908 au BufNewFile,BufRead *.k setf kwt
|
|
909
|
|
910 " KDE script
|
|
911 au BufNewFile,BufRead *.ks setf kscript
|
|
912
|
826
|
913 " Kconfig
|
|
914 au BufNewFile,BufRead Kconfig,Kconfig.debug setf kconfig
|
|
915
|
7
|
916 " Lace (ISE)
|
|
917 au BufNewFile,BufRead *.ace,*.ACE setf lace
|
|
918
|
|
919 " Latte
|
|
920 au BufNewFile,BufRead *.latte,*.lte setf latte
|
|
921
|
375
|
922 " Limits
|
|
923 au BufNewFile,BufRead /etc/limits setf limits
|
|
924
|
7
|
925 " LambdaProlog (*.mod too, see Modsim)
|
|
926 au BufNewFile,BufRead *.sig setf lprolog
|
|
927
|
|
928 " LDAP LDIF
|
|
929 au BufNewFile,BufRead *.ldif setf ldif
|
|
930
|
375
|
931 " Ld loader
|
|
932 au BufNewFile,BufRead *.ld setf ld
|
|
933
|
7
|
934 " Lex
|
|
935 au BufNewFile,BufRead *.lex,*.l setf lex
|
|
936
|
|
937 " Libao
|
|
938 au BufNewFile,BufRead /etc/libao.conf,*/.libao setf libao
|
|
939
|
389
|
940 " Libsensors
|
|
941 au BufNewFile,BufRead /etc/sensors.conf setf sensors
|
|
942
|
7
|
943 " LFTP
|
|
944 au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp
|
|
945
|
|
946 " Lifelines (or Lex for C++!)
|
|
947 au BufNewFile,BufRead *.ll setf lifelines
|
|
948
|
|
949 " Lilo: Linux loader
|
216
|
950 au BufNewFile,BufRead lilo.conf* call s:StarSetf('lilo')
|
7
|
951
|
|
952 " Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp)
|
|
953 if has("fname_case")
|
|
954 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp
|
|
955 else
|
|
956 au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp
|
|
957 endif
|
|
958
|
375
|
959 " SBCL implementation of Common Lisp
|
|
960 au BufNewFile,BufRead sbclrc,.sbclrc setf lisp
|
|
961
|
7
|
962 " Lite
|
|
963 au BufNewFile,BufRead *.lite,*.lt setf lite
|
|
964
|
1219
|
965 " LiteStep RC files
|
|
966 au BufNewFile,BufRead */LiteStep/*/*.rc setf litestep
|
|
967
|
375
|
968 " Login access
|
|
969 au BufNewFile,BufRead /etc/login.access setf loginaccess
|
|
970
|
|
971 " Login defs
|
|
972 au BufNewFile,BufRead /etc/login.defs setf logindefs
|
|
973
|
7
|
974 " Logtalk
|
|
975 au BufNewFile,BufRead *.lgt setf logtalk
|
|
976
|
|
977 " LOTOS
|
|
978 au BufNewFile,BufRead *.lot,*.lotos setf lotos
|
|
979
|
|
980 " Lout (also: *.lt)
|
|
981 au BufNewFile,BufRead *.lou,*.lout setf lout
|
|
982
|
|
983 " Lua
|
|
984 au BufNewFile,BufRead *.lua setf lua
|
|
985
|
1648
|
986 " Linden Scripting Language (Second Life)
|
|
987 au BufNewFile,BufRead *.lsl setf lsl
|
|
988
|
7
|
989 " Lynx style file (or LotusScript!)
|
|
990 au BufNewFile,BufRead *.lss setf lss
|
|
991
|
|
992 " M4
|
|
993 au BufNewFile,BufRead *.m4
|
|
994 \ if expand("<afile>") !~? 'html.m4$\|fvwm2rc' | setf m4 | endif
|
|
995
|
|
996 " MaGic Point
|
|
997 au BufNewFile,BufRead *.mgp setf mgp
|
|
998
|
1125
|
999 " Mail (for Elm, trn, mutt, muttng, rn, slrn)
|
1648
|
1000 au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt{ng,}-*-\w\+,mutt[[:alnum:]_-]\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail
|
7
|
1001
|
809
|
1002 " Mail aliases
|
|
1003 au BufNewFile,BufRead /etc/mail/aliases,/etc/aliases setf mailaliases
|
|
1004
|
7
|
1005 " Mailcap configuration file
|
|
1006 au BufNewFile,BufRead .mailcap,mailcap setf mailcap
|
|
1007
|
|
1008 " Makefile
|
|
1009 au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make
|
|
1010
|
|
1011 " MakeIndex
|
|
1012 au BufNewFile,BufRead *.ist,*.mst setf ist
|
|
1013
|
|
1014 " Manpage
|
|
1015 au BufNewFile,BufRead *.man setf man
|
|
1016
|
389
|
1017 " Man config
|
819
|
1018 au BufNewFile,BufRead /etc/man.conf,man.config setf manconf
|
389
|
1019
|
7
|
1020 " Maple V
|
|
1021 au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple
|
|
1022
|
1668
|
1023 " Map (UMN mapserver config file)
|
|
1024 au BufNewFile,BufRead *.map setf map
|
|
1025
|
7
|
1026 " Mason
|
|
1027 au BufNewFile,BufRead *.mason,*.mhtml setf mason
|
|
1028
|
|
1029 " Matlab or Objective C
|
216
|
1030 au BufNewFile,BufRead *.m call s:FTm()
|
7
|
1031
|
1219
|
1032 func! s:FTm()
|
7
|
1033 let n = 1
|
|
1034 while n < 10
|
|
1035 let line = getline(n)
|
|
1036 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
|
|
1037 setf objc
|
|
1038 return
|
|
1039 endif
|
|
1040 if line =~ '^\s*%'
|
|
1041 setf matlab
|
|
1042 return
|
|
1043 endif
|
|
1044 if line =~ '^\s*(\*'
|
|
1045 setf mma
|
|
1046 return
|
|
1047 endif
|
|
1048 let n = n + 1
|
|
1049 endwhile
|
271
|
1050 if exists("g:filetype_m")
|
|
1051 exe "setf " . g:filetype_m
|
|
1052 else
|
|
1053 setf matlab
|
|
1054 endif
|
1219
|
1055 endfunc
|
7
|
1056
|
1648
|
1057 " Mathematica notebook
|
|
1058 au BufNewFile,BufRead *.nb setf mma
|
|
1059
|
7
|
1060 " Maya Extension Language
|
|
1061 au BufNewFile,BufRead *.mel setf mel
|
|
1062
|
1125
|
1063 " Messages
|
|
1064 au BufNewFile,BufRead /var/log/messages,/var/log/messages.*[0-9] setf messages
|
|
1065
|
7
|
1066 " Metafont
|
|
1067 au BufNewFile,BufRead *.mf setf mf
|
|
1068
|
|
1069 " MetaPost
|
|
1070 au BufNewFile,BufRead *.mp setf mp
|
|
1071
|
683
|
1072 " MGL
|
|
1073 au BufNewFile,BufRead *.mgl setf mgl
|
|
1074
|
7
|
1075 " MMIX or VMS makefile
|
216
|
1076 au BufNewFile,BufRead *.mms call s:FTmms()
|
7
|
1077
|
1648
|
1078 " Symbian meta-makefile definition (MMP)
|
|
1079 au BufNewFile,BufRead *.mmp setf mmp
|
|
1080
|
1219
|
1081 func! s:FTmms()
|
7
|
1082 let n = 1
|
|
1083 while n < 10
|
|
1084 let line = getline(n)
|
|
1085 if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
|
|
1086 setf mmix
|
|
1087 return
|
|
1088 endif
|
|
1089 if line =~ '^\s*#'
|
|
1090 setf make
|
|
1091 return
|
|
1092 endif
|
|
1093 let n = n + 1
|
|
1094 endwhile
|
|
1095 setf mmix
|
1219
|
1096 endfunc
|
7
|
1097
|
|
1098
|
|
1099 " Modsim III (or LambdaProlog)
|
|
1100 au BufNewFile,BufRead *.mod
|
|
1101 \ if getline(1) =~ '\<module\>' |
|
|
1102 \ setf lprolog |
|
|
1103 \ else |
|
|
1104 \ setf modsim3 |
|
|
1105 \ endif
|
|
1106
|
|
1107 " Modula 2
|
|
1108 au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2
|
|
1109
|
|
1110 " Modula 3 (.m3, .i3, .mg, .ig)
|
|
1111 au BufNewFile,BufRead *.[mi][3g] setf modula3
|
|
1112
|
|
1113 " Monk
|
|
1114 au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk
|
|
1115
|
|
1116 " MOO
|
|
1117 au BufNewFile,BufRead *.moo setf moo
|
|
1118
|
|
1119 " Modconf
|
|
1120 au BufNewFile,BufRead /etc/modules.conf,/etc/conf.modules setf modconf
|
|
1121 au BufNewFile,BufRead /etc/modutils/*
|
216
|
1122 \ if executable(expand("<afile>")) != 1
|
|
1123 \| call s:StarSetf('modconf')
|
|
1124 \|endif
|
7
|
1125
|
|
1126 " Mplayer config
|
|
1127 au BufNewFile,BufRead mplayer.conf,*/.mplayer/config setf mplayerconf
|
|
1128
|
|
1129 " Moterola S record
|
|
1130 au BufNewFile,BufRead *.s19,*.s28,*.s37 setf srec
|
|
1131
|
846
|
1132 " Mrxvtrc
|
|
1133 au BufNewFile,BufRead mrxvtrc,.mrxvtrc setf mrxvtrc
|
|
1134
|
7
|
1135 " Msql
|
|
1136 au BufNewFile,BufRead *.msql setf msql
|
|
1137
|
|
1138 " Mysql
|
|
1139 au BufNewFile,BufRead *.mysql setf mysql
|
|
1140
|
|
1141 " M$ Resource files
|
|
1142 au BufNewFile,BufRead *.rc setf rc
|
|
1143
|
12
|
1144 " MuPAD source
|
|
1145 au BufRead,BufNewFile *.mu setf mupad
|
|
1146
|
7
|
1147 " Mush
|
|
1148 au BufNewFile,BufRead *.mush setf mush
|
|
1149
|
1125
|
1150 " Mutt setup file (also for Muttng)
|
1648
|
1151 au BufNewFile,BufRead Mutt{ng,}rc setf muttrc
|
7
|
1152
|
389
|
1153 " Nano
|
|
1154 au BufNewFile,BufRead /etc/nanorc,.nanorc setf nanorc
|
|
1155
|
7
|
1156 " Nastran input/DMAP
|
|
1157 "au BufNewFile,BufRead *.dat setf nastran
|
|
1158
|
|
1159 " Natural
|
|
1160 au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural
|
|
1161
|
39
|
1162 " Netrc
|
|
1163 au BufNewFile,BufRead .netrc setf netrc
|
|
1164
|
7
|
1165 " Novell netware batch files
|
|
1166 au BufNewFile,BufRead *.ncf setf ncf
|
|
1167
|
|
1168 " Nroff/Troff (*.ms and *.t are checked below)
|
|
1169 au BufNewFile,BufRead *.me
|
|
1170 \ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" |
|
|
1171 \ setf nroff |
|
|
1172 \ endif
|
|
1173 au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff
|
216
|
1174 au BufNewFile,BufRead *.[1-9] call s:FTnroff()
|
7
|
1175
|
|
1176 " This function checks if one of the first five lines start with a dot. In
|
|
1177 " that case it is probably an nroff file: 'filetype' is set and 1 is returned.
|
1219
|
1178 func! s:FTnroff()
|
7
|
1179 if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.'
|
|
1180 setf nroff
|
|
1181 return 1
|
|
1182 endif
|
|
1183 return 0
|
1219
|
1184 endfunc
|
7
|
1185
|
|
1186 " Nroff or Objective C++
|
216
|
1187 au BufNewFile,BufRead *.mm call s:FTmm()
|
7
|
1188
|
1219
|
1189 func! s:FTmm()
|
7
|
1190 let n = 1
|
|
1191 while n < 10
|
|
1192 let line = getline(n)
|
|
1193 if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
|
|
1194 setf objcpp
|
|
1195 return
|
|
1196 endif
|
|
1197 let n = n + 1
|
|
1198 endwhile
|
|
1199 setf nroff
|
1219
|
1200 endfunc
|
7
|
1201
|
|
1202 " Not Quite C
|
|
1203 au BufNewFile,BufRead *.nqc setf nqc
|
|
1204
|
|
1205 " NSIS
|
|
1206 au BufNewFile,BufRead *.nsi setf nsis
|
|
1207
|
|
1208 " OCAML
|
|
1209 au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly setf ocaml
|
|
1210
|
|
1211 " Occam
|
|
1212 au BufNewFile,BufRead *.occ setf occam
|
|
1213
|
|
1214 " Omnimark
|
|
1215 au BufNewFile,BufRead *.xom,*.xin setf omnimark
|
|
1216
|
|
1217 " OpenROAD
|
|
1218 au BufNewFile,BufRead *.or setf openroad
|
|
1219
|
|
1220 " OPL
|
|
1221 au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl
|
|
1222
|
|
1223 " Oracle config file
|
|
1224 au BufNewFile,BufRead *.ora setf ora
|
|
1225
|
|
1226 " Packet filter conf
|
|
1227 au BufNewFile,BufRead pf.conf setf pf
|
|
1228
|
375
|
1229 " Pam conf
|
|
1230 au BufNewFile,BufRead /etc/pam.conf setf pamconf
|
|
1231
|
7
|
1232 " PApp
|
|
1233 au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
|
|
1234
|
389
|
1235 " Password file
|
1668
|
1236 au BufNewFile,BufRead /etc/passwd,/etc/passwd-,/etc/passwd.edit,/etc/shadow,/etc/shadow-,/var/backups/passwd.bak,/var/backups/shadow.bak setf passwd
|
389
|
1237
|
7
|
1238 " Pascal (also *.p)
|
|
1239 au BufNewFile,BufRead *.pas setf pascal
|
|
1240
|
|
1241 " Delphi project file
|
|
1242 au BufNewFile,BufRead *.dpr setf pascal
|
|
1243
|
1648
|
1244 " PDF
|
|
1245 au BufNewFile,BufRead *.pdf setf pdf
|
|
1246
|
7
|
1247 " Perl
|
|
1248 if has("fname_case")
|
216
|
1249 au BufNewFile,BufRead *.pl,*.PL call s:FTpl()
|
7
|
1250 else
|
216
|
1251 au BufNewFile,BufRead *.pl call s:FTpl()
|
7
|
1252 endif
|
11
|
1253 au BufNewFile,BufRead *.plx setf perl
|
7
|
1254
|
1219
|
1255 func! s:FTpl()
|
7
|
1256 if exists("g:filetype_pl")
|
|
1257 exe "setf " . g:filetype_pl
|
|
1258 else
|
|
1259 " recognize Prolog by specific text in the first non-empty line
|
|
1260 " require a blank after the '%' because Perl uses "%list" and "%translate"
|
|
1261 let l = getline(nextnonblank(1))
|
|
1262 if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
|
|
1263 setf prolog
|
|
1264 else
|
|
1265 setf perl
|
|
1266 endif
|
|
1267 endif
|
1219
|
1268 endfunc
|
7
|
1269
|
|
1270 " Perl, XPM or XPM2
|
|
1271 au BufNewFile,BufRead *.pm
|
|
1272 \ if getline(1) =~ "XPM2" |
|
|
1273 \ setf xpm2 |
|
|
1274 \ elseif getline(1) =~ "XPM" |
|
|
1275 \ setf xpm |
|
|
1276 \ else |
|
|
1277 \ setf perl |
|
|
1278 \ endif
|
|
1279
|
|
1280 " Perl POD
|
|
1281 au BufNewFile,BufRead *.pod setf pod
|
|
1282
|
850
|
1283 " Php, php3, php4, etc.
|
1648
|
1284 " Also Phtml (was used for PHP 2 in the past)
|
|
1285 " Also .ctp for Cake template file
|
|
1286 au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp setf php
|
7
|
1287
|
|
1288 " Pike
|
|
1289 au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike
|
|
1290
|
|
1291 " Pinfo config
|
|
1292 au BufNewFile,BufRead */etc/pinforc,*/.pinforc setf pinfo
|
|
1293
|
|
1294 " Palm Resource compiler
|
|
1295 au BufNewFile,BufRead *.rcp setf pilrc
|
|
1296
|
|
1297 " Pine config
|
|
1298 au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine
|
|
1299
|
|
1300 " PL/M (also: *.inp)
|
|
1301 au BufNewFile,BufRead *.plm,*.p36,*.pac setf plm
|
|
1302
|
|
1303 " PL/SQL
|
|
1304 au BufNewFile,BufRead *.pls,*.plsql setf plsql
|
|
1305
|
|
1306 " PLP
|
|
1307 au BufNewFile,BufRead *.plp setf plp
|
|
1308
|
|
1309 " PO and PO template (GNU gettext)
|
|
1310 au BufNewFile,BufRead *.po,*.pot setf po
|
|
1311
|
|
1312 " Postfix main config
|
|
1313 au BufNewFile,BufRead main.cf setf pfmain
|
|
1314
|
|
1315 " PostScript (+ font files, encapsulated PostScript, Adobe Illustrator)
|
|
1316 au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr
|
|
1317
|
|
1318 " PostScript Printer Description
|
|
1319 au BufNewFile,BufRead *.ppd setf ppd
|
|
1320
|
|
1321 " Povray
|
|
1322 au BufNewFile,BufRead *.pov setf pov
|
|
1323
|
|
1324 " Povray configuration
|
|
1325 au BufNewFile,BufRead .povrayrc setf povini
|
|
1326
|
|
1327 " Povray, PHP or assembly
|
216
|
1328 au BufNewFile,BufRead *.inc call s:FTinc()
|
7
|
1329
|
1219
|
1330 func! s:FTinc()
|
7
|
1331 if exists("g:filetype_inc")
|
|
1332 exe "setf " . g:filetype_inc
|
|
1333 else
|
|
1334 let lines = getline(1).getline(2).getline(3)
|
|
1335 if lines =~? "perlscript"
|
|
1336 setf aspperl
|
|
1337 elseif lines =~ "<%"
|
|
1338 setf aspvbs
|
|
1339 elseif lines =~ "<?"
|
|
1340 setf php
|
|
1341 else
|
216
|
1342 call s:FTasmsyntax()
|
7
|
1343 if exists("b:asmsyntax")
|
|
1344 exe "setf " . b:asmsyntax
|
|
1345 else
|
|
1346 setf pov
|
|
1347 endif
|
|
1348 endif
|
|
1349 endif
|
1219
|
1350 endfunc
|
7
|
1351
|
|
1352 " Printcap and Termcap
|
|
1353 au BufNewFile,BufRead *printcap
|
|
1354 \ let b:ptcap_type = "print" | setf ptcap
|
|
1355 au BufNewFile,BufRead *termcap
|
|
1356 \ let b:ptcap_type = "term" | setf ptcap
|
|
1357
|
|
1358 " PCCTS / ANTRL
|
|
1359 "au BufNewFile,BufRead *.g setf antrl
|
|
1360 au BufNewFile,BufRead *.g setf pccts
|
|
1361
|
|
1362 " PPWizard
|
|
1363 au BufNewFile,BufRead *.it,*.ih setf ppwiz
|
|
1364
|
|
1365 " Oracle Pro*C/C++
|
1287
|
1366 au BufNewFile,BufRead *.pc setf proc
|
7
|
1367
|
1125
|
1368 " Privoxy actions file
|
|
1369 au BufNewFile,BufRead *.action setf privoxy
|
|
1370
|
7
|
1371 " Procmail
|
|
1372 au BufNewFile,BufRead .procmail,.procmailrc setf procmail
|
|
1373
|
|
1374 " Progress or CWEB
|
216
|
1375 au BufNewFile,BufRead *.w call s:FTprogress_cweb()
|
7
|
1376
|
1219
|
1377 func! s:FTprogress_cweb()
|
7
|
1378 if exists("g:filetype_w")
|
|
1379 exe "setf " . g:filetype_w
|
|
1380 return
|
|
1381 endif
|
|
1382 if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE'
|
|
1383 setf progress
|
|
1384 else
|
|
1385 setf cweb
|
|
1386 endif
|
1219
|
1387 endfunc
|
7
|
1388
|
|
1389 " Progress or assembly
|
216
|
1390 au BufNewFile,BufRead *.i call s:FTprogress_asm()
|
7
|
1391
|
1219
|
1392 func! s:FTprogress_asm()
|
7
|
1393 if exists("g:filetype_i")
|
|
1394 exe "setf " . g:filetype_i
|
|
1395 return
|
|
1396 endif
|
|
1397 " This function checks for an assembly comment the first ten lines.
|
|
1398 " If not found, assume Progress.
|
|
1399 let lnum = 1
|
500
|
1400 while lnum <= 10 && lnum < line('$')
|
7
|
1401 let line = getline(lnum)
|
|
1402 if line =~ '^\s*;' || line =~ '^\*'
|
216
|
1403 call s:FTasm()
|
7
|
1404 return
|
|
1405 elseif line !~ '^\s*$' || line =~ '^/\*'
|
|
1406 " Not an empty line: Doesn't look like valid assembly code.
|
|
1407 " Or it looks like a Progress /* comment
|
|
1408 break
|
|
1409 endif
|
|
1410 let lnum = lnum + 1
|
|
1411 endw
|
|
1412 setf progress
|
1219
|
1413 endfunc
|
7
|
1414
|
|
1415 " Progress or Pascal
|
216
|
1416 au BufNewFile,BufRead *.p call s:FTprogress_pascal()
|
7
|
1417
|
1219
|
1418 func! s:FTprogress_pascal()
|
7
|
1419 if exists("g:filetype_p")
|
|
1420 exe "setf " . g:filetype_p
|
|
1421 return
|
|
1422 endif
|
|
1423 " This function checks for valid Pascal syntax in the first ten lines.
|
|
1424 " Look for either an opening comment or a program start.
|
|
1425 " If not found, assume Progress.
|
|
1426 let lnum = 1
|
500
|
1427 while lnum <= 10 && lnum < line('$')
|
7
|
1428 let line = getline(lnum)
|
500
|
1429 if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>'
|
7
|
1430 \ || line =~ '^\s*{' || line =~ '^\s*(\*'
|
|
1431 setf pascal
|
|
1432 return
|
|
1433 elseif line !~ '^\s*$' || line =~ '^/\*'
|
|
1434 " Not an empty line: Doesn't look like valid Pascal code.
|
|
1435 " Or it looks like a Progress /* comment
|
|
1436 break
|
|
1437 endif
|
|
1438 let lnum = lnum + 1
|
|
1439 endw
|
|
1440 setf progress
|
1219
|
1441 endfunc
|
7
|
1442
|
|
1443
|
|
1444 " Software Distributor Product Specification File (POSIX 1387.2-1995)
|
|
1445 au BufNewFile,BufRead *.psf setf psf
|
|
1446 au BufNewFile,BufRead INDEX,INFO
|
|
1447 \ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' |
|
|
1448 \ setf psf |
|
|
1449 \ endif
|
|
1450
|
|
1451 " Prolog
|
|
1452 au BufNewFile,BufRead *.pdb setf prolog
|
|
1453
|
1648
|
1454 " Promela
|
|
1455 au BufNewFile,BufRead *.pml setf promela
|
|
1456
|
389
|
1457 " Protocols
|
|
1458 au BufNewFile,BufRead /etc/protocols setf protocols
|
|
1459
|
7
|
1460 " Pyrex
|
|
1461 au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
|
|
1462
|
|
1463 " Python
|
|
1464 au BufNewFile,BufRead *.py,*.pyw setf python
|
|
1465
|
|
1466 " Radiance
|
|
1467 au BufNewFile,BufRead *.rad,*.mat setf radiance
|
|
1468
|
|
1469 " Ratpoison config/command files
|
|
1470 au BufNewFile,BufRead .ratpoisonrc,ratpoisonrc setf ratpoison
|
|
1471
|
|
1472 " RCS file
|
|
1473 au BufNewFile,BufRead *\,v setf rcs
|
|
1474
|
|
1475 " Readline
|
237
|
1476 au BufNewFile,BufRead .inputrc,inputrc setf readline
|
7
|
1477
|
|
1478 " Registry for MS-Windows
|
|
1479 au BufNewFile,BufRead *.reg
|
|
1480 \ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif
|
|
1481
|
|
1482 " Renderman Interface Bytestream
|
|
1483 au BufNewFile,BufRead *.rib setf rib
|
|
1484
|
|
1485 " Rexx
|
1648
|
1486 au BufNewFile,BufRead *.rexx,*.rex,*.jrexx,*.rxj,*.orx setf rexx
|
7
|
1487
|
|
1488 " R (Splus)
|
836
|
1489 if has("fname_case")
|
|
1490 au BufNewFile,BufRead *.s,*.S setf r
|
|
1491 else
|
|
1492 au BufNewFile,BufRead *.s setf r
|
|
1493 endif
|
7
|
1494
|
699
|
1495 " R Help file
|
836
|
1496 if has("fname_case")
|
|
1497 au BufNewFile,BufRead *.rd,*.Rd setf rhelp
|
|
1498 else
|
|
1499 au BufNewFile,BufRead *.rd setf rhelp
|
|
1500 endif
|
|
1501
|
|
1502 " R noweb file
|
|
1503 if has("fname_case")
|
|
1504 au BufNewFile,BufRead *.Rnw,*.rnw,*.Snw,*.snw setf rnoweb
|
|
1505 else
|
|
1506 au BufNewFile,BufRead *.rnw,*.snw setf rnoweb
|
|
1507 endif
|
699
|
1508
|
7
|
1509 " Rexx, Rebol or R
|
216
|
1510 au BufNewFile,BufRead *.r,*.R call s:FTr()
|
7
|
1511
|
1219
|
1512 func! s:FTr()
|
1125
|
1513 let max = line("$") > 50 ? 50 : line("$")
|
|
1514
|
|
1515 for n in range(1, max)
|
|
1516 " Rebol is easy to recognize, check for that first
|
1648
|
1517 if getline(n) =~? '\<REBOL\>'
|
1125
|
1518 setf rebol
|
|
1519 return
|
7
|
1520 endif
|
1125
|
1521 endfor
|
|
1522
|
|
1523 for n in range(1, max)
|
|
1524 " R has # comments
|
|
1525 if getline(n) =~ '^\s*#'
|
|
1526 setf r
|
|
1527 return
|
|
1528 endif
|
|
1529 " Rexx has /* comments */
|
|
1530 if getline(n) =~ '^\s*/\*'
|
7
|
1531 setf rexx
|
1125
|
1532 return
|
7
|
1533 endif
|
1125
|
1534 endfor
|
|
1535
|
|
1536 " Nothing recognized, assume Rexx
|
|
1537 setf rexx
|
1219
|
1538 endfunc
|
7
|
1539
|
|
1540 " Remind
|
216
|
1541 au BufNewFile,BufRead .reminders* call s:StarSetf('remind')
|
7
|
1542
|
|
1543 " Resolv.conf
|
|
1544 au BufNewFile,BufRead resolv.conf setf resolv
|
|
1545
|
|
1546 " Relax NG Compact
|
|
1547 au BufNewFile,BufRead *.rnc setf rnc
|
|
1548
|
|
1549 " RPL/2
|
|
1550 au BufNewFile,BufRead *.rpl setf rpl
|
|
1551
|
|
1552 " Robots.txt
|
|
1553 au BufNewFile,BufRead robots.txt setf robots
|
|
1554
|
|
1555 " Rpcgen
|
|
1556 au BufNewFile,BufRead *.x setf rpcgen
|
|
1557
|
|
1558 " reStructuredText Documentation Format
|
|
1559 au BufNewFile,BufRead *.rst setf rst
|
|
1560
|
|
1561 " RTF
|
|
1562 au BufNewFile,BufRead *.rtf setf rtf
|
|
1563
|
|
1564 " Ruby
|
|
1565 au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby
|
|
1566
|
1219
|
1567 " Ruby on Rails
|
|
1568 au BufNewFile,BufRead *.builder,*.rxml,*.rjs setf ruby
|
|
1569
|
|
1570 " Rantfile and Rakefile is like Ruby
|
|
1571 au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake setf ruby
|
557
|
1572
|
7
|
1573 " S-lang (or shader language!)
|
|
1574 au BufNewFile,BufRead *.sl setf slang
|
|
1575
|
|
1576 " Samba config
|
|
1577 au BufNewFile,BufRead smb.conf setf samba
|
|
1578
|
|
1579 " SAS script
|
|
1580 au BufNewFile,BufRead *.sas setf sas
|
|
1581
|
1668
|
1582 " Sass
|
|
1583 au BufNewFile,BufRead *.sass setf sass
|
|
1584
|
7
|
1585 " Sather
|
|
1586 au BufNewFile,BufRead *.sa setf sather
|
|
1587
|
|
1588 " Scilab
|
809
|
1589 au BufNewFile,BufRead *.sci,*.sce setf scilab
|
7
|
1590
|
1125
|
1591 " SD: Streaming Descriptors
|
|
1592 au BufNewFile,BufRead *.sd setf sd
|
|
1593
|
7
|
1594 " SDL
|
|
1595 au BufNewFile,BufRead *.sdl,*.pr setf sdl
|
|
1596
|
|
1597 " sed
|
|
1598 au BufNewFile,BufRead *.sed setf sed
|
|
1599
|
36
|
1600 " Sieve (RFC 3028)
|
|
1601 au BufNewFile,BufRead *.siv setf sieve
|
|
1602
|
7
|
1603 " Sendmail
|
|
1604 au BufNewFile,BufRead sendmail.cf setf sm
|
|
1605
|
1648
|
1606 " Sendmail .mc files are actually m4. Could also be MS Message text file.
|
|
1607 au BufNewFile,BufRead *.mc call s:McSetf()
|
|
1608
|
|
1609 func! s:McSetf()
|
|
1610 " Rely on the file to start with a comment.
|
|
1611 " MS message text files use ';', Sendmail files use '#' or 'dnl'
|
|
1612 for lnum in range(1, min([line("$"), 20]))
|
|
1613 let line = getline(lnum)
|
|
1614 if line =~ '^\s*\(#\|dnl\)'
|
|
1615 setf m4 " Sendmail .mc file
|
|
1616 return
|
|
1617 elseif line =~ '^\s*;'
|
|
1618 setf msmessages " MS Message text file
|
|
1619 return
|
|
1620 endif
|
|
1621 endfor
|
|
1622 setf m4 " Default: Sendmail .mc file
|
|
1623 endfunc
|
7
|
1624
|
389
|
1625 " Services
|
|
1626 au BufNewFile,BufRead /etc/services setf services
|
|
1627
|
|
1628 " Service Location config
|
|
1629 au BufNewFile,BufRead /etc/slp.conf setf slpconf
|
|
1630
|
|
1631 " Service Location registration
|
|
1632 au BufNewFile,BufRead /etc/slp.reg setf slpreg
|
|
1633
|
|
1634 " Service Location SPI
|
|
1635 au BufNewFile,BufRead /etc/slp.spi setf slpspi
|
|
1636
|
|
1637 " Setserial config
|
|
1638 au BufNewFile,BufRead /etc/serial.conf setf setserial
|
|
1639
|
7
|
1640 " SGML
|
|
1641 au BufNewFile,BufRead *.sgm,*.sgml
|
|
1642 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' |
|
|
1643 \ setf sgmllnx |
|
|
1644 \ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' |
|
|
1645 \ let b:docbk_type="sgml" |
|
|
1646 \ setf docbk |
|
|
1647 \ else |
|
|
1648 \ setf sgml |
|
|
1649 \ endif
|
|
1650
|
|
1651 " SGMLDECL
|
|
1652 au BufNewFile,BufRead *.decl,*.dcl,*.dec
|
|
1653 \ if getline(1).getline(2).getline(3) =~? '^<!SGML' |
|
|
1654 \ setf sgmldecl |
|
|
1655 \ endif
|
|
1656
|
|
1657 " SGML catalog file
|
216
|
1658 au BufNewFile,BufRead catalog setf catalog
|
|
1659 au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog')
|
7
|
1660
|
|
1661 " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc.
|
|
1662 " Gentoo ebuilds are actually bash scripts
|
|
1663 au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash")
|
|
1664 au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh")
|
|
1665 au BufNewFile,BufRead /etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1))
|
|
1666
|
216
|
1667 " Also called from scripts.vim.
|
1219
|
1668 func! SetFileTypeSH(name)
|
216
|
1669 if expand("<amatch>") =~ g:ft_ignore_pat
|
|
1670 return
|
|
1671 endif
|
7
|
1672 if a:name =~ '\<ksh\>'
|
|
1673 let b:is_kornshell = 1
|
|
1674 if exists("b:is_bash")
|
|
1675 unlet b:is_bash
|
|
1676 endif
|
|
1677 if exists("b:is_sh")
|
|
1678 unlet b:is_sh
|
|
1679 endif
|
|
1680 elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>'
|
|
1681 let b:is_bash = 1
|
|
1682 if exists("b:is_kornshell")
|
|
1683 unlet b:is_kornshell
|
|
1684 endif
|
|
1685 if exists("b:is_sh")
|
|
1686 unlet b:is_sh
|
|
1687 endif
|
|
1688 elseif a:name =~ '\<sh\>'
|
|
1689 let b:is_sh = 1
|
|
1690 if exists("b:is_kornshell")
|
|
1691 unlet b:is_kornshell
|
|
1692 endif
|
|
1693 if exists("b:is_bash")
|
|
1694 unlet b:is_bash
|
|
1695 endif
|
|
1696 endif
|
26
|
1697 call SetFileTypeShell("sh")
|
1219
|
1698 endfunc
|
26
|
1699
|
|
1700 " For shell-like file types, check for an "exec" command hidden in a comment,
|
|
1701 " as used for Tcl.
|
216
|
1702 " Also called from scripts.vim, thus can't be local to this script.
|
1219
|
1703 func! SetFileTypeShell(name)
|
216
|
1704 if expand("<amatch>") =~ g:ft_ignore_pat
|
|
1705 return
|
|
1706 endif
|
26
|
1707 let l = 2
|
|
1708 while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)'
|
|
1709 " Skip empty and comment lines.
|
|
1710 let l = l + 1
|
|
1711 endwhile
|
|
1712 if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$'
|
|
1713 " Found an "exec" line after a comment with continuation
|
|
1714 let n = substitute(getline(l),'\s*exec\s\+\([^ ]*/\)\=', '', '')
|
|
1715 if n =~ '\<tclsh\|\<wish'
|
|
1716 setf tcl
|
|
1717 return
|
|
1718 endif
|
|
1719 endif
|
|
1720 exe "setf " . a:name
|
1219
|
1721 endfunc
|
7
|
1722
|
|
1723 " tcsh scripts
|
26
|
1724 au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call SetFileTypeShell("tcsh")
|
7
|
1725
|
|
1726 " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh)
|
216
|
1727 au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call s:CSH()
|
7
|
1728
|
1219
|
1729 func! s:CSH()
|
7
|
1730 if exists("g:filetype_csh")
|
26
|
1731 call SetFileTypeShell(g:filetype_csh)
|
7
|
1732 elseif &shell =~ "tcsh"
|
26
|
1733 call SetFileTypeShell("tcsh")
|
7
|
1734 else
|
26
|
1735 call SetFileTypeShell("csh")
|
7
|
1736 endif
|
1219
|
1737 endfunc
|
7
|
1738
|
|
1739 " Z-Shell script
|
216
|
1740 au BufNewFile,BufRead .zprofile,/etc/zprofile,.zfbfmarks setf zsh
|
|
1741 au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh')
|
7
|
1742
|
|
1743 " Scheme
|
|
1744 au BufNewFile,BufRead *.scm,*.ss setf scheme
|
|
1745
|
|
1746 " Screen RC
|
|
1747 au BufNewFile,BufRead .screenrc,screenrc setf screen
|
|
1748
|
|
1749 " Simula
|
|
1750 au BufNewFile,BufRead *.sim setf simula
|
|
1751
|
|
1752 " SINDA
|
|
1753 au BufNewFile,BufRead *.sin,*.s85 setf sinda
|
|
1754
|
819
|
1755 " SiSU
|
857
|
1756 au BufNewFile,BufRead *.sst,*.ssm,*.ssi,*.-sst,*._sst setf sisu
|
819
|
1757 au BufNewFile,BufRead *.sst.meta,*.-sst.meta,*._sst.meta setf sisu
|
|
1758
|
7
|
1759 " SKILL
|
336
|
1760 au BufNewFile,BufRead *.il,*.ils,*.cdf setf skill
|
7
|
1761
|
|
1762 " SLRN
|
|
1763 au BufNewFile,BufRead .slrnrc setf slrnrc
|
|
1764 au BufNewFile,BufRead *.score setf slrnsc
|
|
1765
|
271
|
1766 " Smalltalk (and TeX)
|
|
1767 au BufNewFile,BufRead *.st setf st
|
|
1768 au BufNewFile,BufRead *.cls
|
|
1769 \ if getline(1) =~ '^%' |
|
|
1770 \ setf tex |
|
|
1771 \ else |
|
|
1772 \ setf st |
|
|
1773 \ endif
|
7
|
1774
|
|
1775 " Smarty templates
|
|
1776 au BufNewFile,BufRead *.tpl setf smarty
|
|
1777
|
|
1778 " SMIL or XML
|
|
1779 au BufNewFile,BufRead *.smil
|
|
1780 \ if getline(1) =~ '<?\s*xml.*?>' |
|
|
1781 \ setf xml |
|
|
1782 \ else |
|
|
1783 \ setf smil |
|
|
1784 \ endif
|
|
1785
|
|
1786 " SMIL or SNMP MIB file
|
|
1787 au BufNewFile,BufRead *.smi
|
|
1788 \ if getline(1) =~ '\<smil\>' |
|
|
1789 \ setf smil |
|
|
1790 \ else |
|
|
1791 \ setf mib |
|
|
1792 \ endif
|
|
1793
|
|
1794 " SMITH
|
|
1795 au BufNewFile,BufRead *.smt,*.smith setf smith
|
|
1796
|
857
|
1797 " Snobol4 and spitbol
|
|
1798 au BufNewFile,BufRead *.sno,*.spt setf snobol4
|
7
|
1799
|
|
1800 " SNMP MIB files
|
|
1801 au BufNewFile,BufRead *.mib,*.my setf mib
|
|
1802
|
|
1803 " Snort Configuration
|
1219
|
1804 au BufNewFile,BufRead *.hog,snort.conf,vision.conf setf hog
|
|
1805 au BufNewFile,BufRead *.rules call s:FTRules()
|
|
1806
|
|
1807 let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*'
|
|
1808 func! s:FTRules()
|
1668
|
1809 if expand('<amatch>:p') =~ '^/etc/udev/\%(rules\.d/\)\=.*\.rules$'
|
1648
|
1810 setf udevrules
|
|
1811 return
|
|
1812 endif
|
1219
|
1813 try
|
|
1814 let config_lines = readfile('/etc/udev/udev.conf')
|
|
1815 catch /^Vim\%((\a\+)\)\=:E484/
|
|
1816 setf hog
|
|
1817 return
|
|
1818 endtry
|
1648
|
1819 let dir = expand('<amatch>:p:h')
|
1219
|
1820 for line in config_lines
|
|
1821 if line =~ s:ft_rules_udev_rules_pattern
|
|
1822 let udev_rules = substitute(line, s:ft_rules_udev_rules_pattern, '\1', "")
|
1648
|
1823 if dir == udev_rules
|
1219
|
1824 setf udevrules
|
|
1825 endif
|
|
1826 break
|
|
1827 endif
|
|
1828 endfor
|
|
1829 setf hog
|
|
1830 endfunc
|
|
1831
|
7
|
1832
|
|
1833 " Spec (Linux RPM)
|
|
1834 au BufNewFile,BufRead *.spec setf spec
|
|
1835
|
|
1836 " Speedup (AspenTech plant simulator)
|
|
1837 au BufNewFile,BufRead *.speedup,*.spdata,*.spd setf spup
|
|
1838
|
|
1839 " Slice
|
|
1840 au BufNewFile,BufRead *.ice setf slice
|
|
1841
|
|
1842 " Spice
|
|
1843 au BufNewFile,BufRead *.sp,*.spice setf spice
|
|
1844
|
|
1845 " Spyce
|
|
1846 au BufNewFile,BufRead *.spy,*.spi setf spyce
|
|
1847
|
|
1848 " Squid
|
|
1849 au BufNewFile,BufRead squid.conf setf squid
|
|
1850
|
22
|
1851 " SQL for Oracle Designer
|
|
1852 au BufNewFile,BufRead *.tyb,*.typ,*.tyc,*.pkb,*.pks setf sql
|
|
1853
|
|
1854 " SQL
|
216
|
1855 au BufNewFile,BufRead *.sql call s:SQL()
|
22
|
1856
|
1219
|
1857 func! s:SQL()
|
22
|
1858 if exists("g:filetype_sql")
|
|
1859 exe "setf " . g:filetype_sql
|
|
1860 else
|
|
1861 setf sql
|
|
1862 endif
|
1219
|
1863 endfunc
|
7
|
1864
|
|
1865 " SQLJ
|
|
1866 au BufNewFile,BufRead *.sqlj setf sqlj
|
|
1867
|
|
1868 " SQR
|
|
1869 au BufNewFile,BufRead *.sqr,*.sqi setf sqr
|
|
1870
|
|
1871 " OpenSSH configuration
|
|
1872 au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig
|
|
1873
|
|
1874 " OpenSSH server configuration
|
|
1875 au BufNewFile,BufRead sshd_config setf sshdconfig
|
|
1876
|
831
|
1877 " Stata
|
|
1878 au BufNewFile,BufRead *.ado,*.class,*.do,*.imata,*.mata setf stata
|
|
1879
|
|
1880 " SMCL
|
|
1881 au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl
|
|
1882
|
7
|
1883 " Stored Procedures
|
|
1884 au BufNewFile,BufRead *.stp setf stp
|
|
1885
|
|
1886 " Standard ML
|
|
1887 au BufNewFile,BufRead *.sml setf sml
|
|
1888
|
1648
|
1889 " Sratus VOS command macro
|
|
1890 au BufNewFile,BufRead *.cm setf voscm
|
|
1891
|
375
|
1892 " Sysctl
|
|
1893 au BufNewFile,BufRead /etc/sysctl.conf setf sysctl
|
|
1894
|
39
|
1895 " Sudoers
|
|
1896 au BufNewFile,BufRead /etc/sudoers,sudoers.tmp setf sudoers
|
|
1897
|
826
|
1898 " If the file has an extension of 't' and is in a directory 't' then it is
|
|
1899 " almost certainly a Perl test file.
|
557
|
1900 " If the first line starts with '#' and contains 'perl' it's probably a Perl
|
|
1901 " file.
|
826
|
1902 " (Slow test) If a file contains a 'use' statement then it is almost certainly
|
|
1903 " a Perl file.
|
1219
|
1904 func! s:FTperl()
|
826
|
1905 if expand("%:e") == 't' && expand("%:p:h:t") == 't'
|
|
1906 setf perl
|
|
1907 return 1
|
|
1908 endif
|
557
|
1909 if getline(1)[0] == '#' && getline(1) =~ 'perl'
|
|
1910 setf perl
|
|
1911 return 1
|
|
1912 endif
|
826
|
1913 if search('^use\s\s*\k', 'nc', 30)
|
|
1914 setf perl
|
|
1915 return 1
|
|
1916 endif
|
557
|
1917 return 0
|
1219
|
1918 endfunc
|
557
|
1919
|
|
1920 " Tads (or Nroff or Perl test file)
|
7
|
1921 au BufNewFile,BufRead *.t
|
557
|
1922 \ if !s:FTnroff() && !s:FTperl() | setf tads | endif
|
7
|
1923
|
|
1924 " Tags
|
|
1925 au BufNewFile,BufRead tags setf tags
|
|
1926
|
|
1927 " TAK
|
|
1928 au BufNewFile,BufRead *.tak setf tak
|
|
1929
|
557
|
1930 " Tcl (JACL too)
|
|
1931 au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk,*.jacl setf tcl
|
7
|
1932
|
|
1933 " TealInfo
|
|
1934 au BufNewFile,BufRead *.tli setf tli
|
|
1935
|
|
1936 " Telix Salt
|
|
1937 au BufNewFile,BufRead *.slt setf tsalt
|
|
1938
|
|
1939 " Terminfo
|
|
1940 au BufNewFile,BufRead *.ti setf terminfo
|
|
1941
|
|
1942 " TeX
|
378
|
1943 au BufNewFile,BufRead *.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex
|
|
1944 au BufNewFile,BufRead *.tex call s:FTtex()
|
|
1945
|
800
|
1946 " Choose context, plaintex, or tex (LaTeX) based on these rules:
|
|
1947 " 1. Check the first line of the file for "%&<format>".
|
|
1948 " 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
|
|
1949 " 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc.
|
1219
|
1950 func! s:FTtex()
|
800
|
1951 let firstline = getline(1)
|
|
1952 if firstline =~ '^%&\s*\a\+'
|
|
1953 let format = tolower(matchstr(firstline, '\a\+'))
|
|
1954 let format = substitute(format, 'pdf', '', '')
|
|
1955 if format == 'tex'
|
|
1956 let format = 'plain'
|
378
|
1957 endif
|
800
|
1958 else
|
|
1959 " Default value, may be changed later:
|
|
1960 let format = exists("g:tex_flavor") ? g:tex_flavor : 'plain'
|
|
1961 " Save position, go to the top of the file, find first non-comment line.
|
|
1962 let save_cursor = getpos('.')
|
|
1963 call cursor(1,1)
|
|
1964 let firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
|
|
1965 if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword.
|
|
1966 let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
|
|
1967 let cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
|
|
1968 let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)',
|
|
1969 \ 'cnp', firstNC + 1000)
|
|
1970 if kwline == 1 " lpat matched
|
|
1971 let format = 'latex'
|
|
1972 elseif kwline == 2 " cpat matched
|
|
1973 let format = 'context'
|
|
1974 endif " If neither matched, keep default set above.
|
|
1975 " let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000)
|
|
1976 " let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000)
|
|
1977 " if cline > 0
|
|
1978 " let format = 'context'
|
|
1979 " endif
|
|
1980 " if lline > 0 && (cline == 0 || cline > lline)
|
|
1981 " let format = 'tex'
|
|
1982 " endif
|
|
1983 endif " firstNC
|
|
1984 call setpos('.', save_cursor)
|
|
1985 endif " firstline =~ '^%&\s*\a\+'
|
694
|
1986
|
800
|
1987 " Translation from formats to file types. TODO: add AMSTeX, RevTex, others?
|
|
1988 if format == 'plain'
|
|
1989 setf plaintex
|
|
1990 elseif format == 'context'
|
694
|
1991 setf context
|
800
|
1992 else " probably LaTeX
|
694
|
1993 setf tex
|
|
1994 endif
|
800
|
1995 return
|
1219
|
1996 endfunc
|
378
|
1997
|
1648
|
1998 " ConTeXt
|
|
1999 au BufNewFile,BufRead tex/context/*/*.tex,*.mkii,*.mkiv setf context
|
7
|
2000
|
|
2001 " Texinfo
|
|
2002 au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo
|
|
2003
|
|
2004 " TeX configuration
|
|
2005 au BufNewFile,BufRead texmf.cnf setf texmf
|
|
2006
|
|
2007 " Tidy config
|
|
2008 au BufNewFile,BufRead .tidyrc,tidyrc setf tidy
|
|
2009
|
|
2010 " TF mud client
|
|
2011 au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf
|
|
2012
|
33
|
2013 " TPP - Text Presentation Program
|
|
2014 au BufNewFile,BufReadPost *.tpp setf tpp
|
|
2015
|
555
|
2016 " Trustees
|
|
2017 au BufNewFile,BufRead trustees.conf setf trustees
|
|
2018
|
7
|
2019 " TSS - Geometry
|
|
2020 au BufNewFile,BufReadPost *.tssgm setf tssgm
|
|
2021
|
|
2022 " TSS - Optics
|
|
2023 au BufNewFile,BufReadPost *.tssop setf tssop
|
|
2024
|
|
2025 " TSS - Command Line (temporary)
|
|
2026 au BufNewFile,BufReadPost *.tsscl setf tsscl
|
|
2027
|
|
2028 " Motif UIT/UIL files
|
|
2029 au BufNewFile,BufRead *.uit,*.uil setf uil
|
|
2030
|
389
|
2031 " Udev conf
|
|
2032 au BufNewFile,BufRead /etc/udev/udev.conf setf udevconf
|
|
2033
|
|
2034 " Udev permissions
|
|
2035 au BufNewFile,BufRead /etc/udev/permissions.d/*.permissions setf udevperm
|
|
2036 "
|
|
2037 " Udev symlinks config
|
|
2038 au BufNewFile,BufRead /etc/udev/cdsymlinks.conf setf sh
|
|
2039
|
7
|
2040 " UnrealScript
|
|
2041 au BufNewFile,BufRead *.uc setf uc
|
|
2042
|
375
|
2043 " Updatedb
|
|
2044 au BufNewFile,BufRead /etc/updatedb.conf setf updatedb
|
|
2045
|
836
|
2046 " Vera
|
|
2047 au BufNewFile,BufRead *.vr,*.vri,*.vrh setf vera
|
|
2048
|
7
|
2049 " Verilog HDL
|
|
2050 au BufNewFile,BufRead *.v setf verilog
|
|
2051
|
481
|
2052 " Verilog-AMS HDL
|
|
2053 au BufNewFile,BufRead *.va,*.vams setf verilogams
|
|
2054
|
7
|
2055 " VHDL
|
216
|
2056 au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl
|
375
|
2057 au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl')
|
7
|
2058
|
|
2059 " Vim script
|
794
|
2060 au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim
|
7
|
2061
|
|
2062 " Viminfo file
|
|
2063 au BufNewFile,BufRead .viminfo,_viminfo setf viminfo
|
|
2064
|
|
2065 " Virata Config Script File
|
|
2066 au BufRead,BufNewFile *.hw,*.module,*.pkg setf virata
|
|
2067
|
|
2068 " Visual Basic (also uses *.bas) or FORM
|
216
|
2069 au BufNewFile,BufRead *.frm call s:FTVB("form")
|
7
|
2070
|
|
2071 " SaxBasic is close to Visual Basic
|
|
2072 au BufNewFile,BufRead *.sba setf vb
|
|
2073
|
|
2074 " Vgrindefs file
|
|
2075 au BufNewFile,BufRead vgrindefs setf vgrindefs
|
|
2076
|
|
2077 " VRML V1.0c
|
|
2078 au BufNewFile,BufRead *.wrl setf vrml
|
|
2079
|
|
2080 " Webmacro
|
|
2081 au BufNewFile,BufRead *.wm setf webmacro
|
|
2082
|
|
2083 " Wget config
|
|
2084 au BufNewFile,BufRead .wgetrc,wgetrc setf wget
|
|
2085
|
|
2086 " Website MetaLanguage
|
|
2087 au BufNewFile,BufRead *.wml setf wml
|
|
2088
|
|
2089 " Winbatch
|
|
2090 au BufNewFile,BufRead *.wbt setf winbatch
|
|
2091
|
753
|
2092 " WSML
|
|
2093 au BufNewFile,BufRead *.wsml setf wsml
|
|
2094
|
7
|
2095 " WvDial
|
|
2096 au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial
|
|
2097
|
|
2098 " CVS RC file
|
|
2099 au BufNewFile,BufRead .cvsrc setf cvsrc
|
|
2100
|
|
2101 " CVS commit file
|
|
2102 au BufNewFile,BufRead cvs\d\+ setf cvs
|
|
2103
|
|
2104 " WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment
|
|
2105 " lines in a WEB file).
|
|
2106 au BufNewFile,BufRead *.web
|
|
2107 \ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" |
|
|
2108 \ setf web |
|
|
2109 \ else |
|
|
2110 \ setf winbatch |
|
|
2111 \ endif
|
|
2112
|
|
2113 " Windows Scripting Host and Windows Script Component
|
|
2114 au BufNewFile,BufRead *.ws[fc] setf wsh
|
|
2115
|
1125
|
2116 " XHTML
|
|
2117 au BufNewFile,BufRead *.xhtml,*.xht setf xhtml
|
|
2118
|
7
|
2119 " X Pixmap (dynamically sets colors, use BufEnter to make it work better)
|
|
2120 au BufEnter *.xpm
|
|
2121 \ if getline(1) =~ "XPM2" |
|
|
2122 \ setf xpm2 |
|
|
2123 \ else |
|
|
2124 \ setf xpm |
|
|
2125 \ endif
|
|
2126 au BufEnter *.xpm2 setf xpm2
|
|
2127
|
|
2128 " XFree86 config
|
|
2129 au BufNewFile,BufRead XF86Config
|
|
2130 \ if getline(1) =~ '\<XConfigurator\>' |
|
|
2131 \ let b:xf86c_xfree86_version = 3 |
|
|
2132 \ endif |
|
|
2133 \ setf xf86conf
|
|
2134
|
|
2135 " Xorg config
|
|
2136 au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86c_xfree86_version = 4 | setf xf86conf
|
|
2137
|
375
|
2138 " Xinetd conf
|
|
2139 au BufNewFile,BufRead /etc/xinetd.conf setf xinetd
|
|
2140
|
7
|
2141 " XS Perl extension interface language
|
|
2142 au BufNewFile,BufRead *.xs setf xs
|
|
2143
|
|
2144 " X resources file
|
|
2145 au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults
|
|
2146
|
|
2147 " Xmath
|
|
2148 au BufNewFile,BufRead *.msc,*.msf setf xmath
|
|
2149 au BufNewFile,BufRead *.ms
|
216
|
2150 \ if !s:FTnroff() | setf xmath | endif
|
7
|
2151
|
1648
|
2152 " XML specific variants: docbk and xbl
|
|
2153 au BufNewFile,BufRead *.xml call s:FTxml()
|
|
2154
|
|
2155 func! s:FTxml()
|
|
2156 let n = 1
|
|
2157 while n < 100 && n < line("$")
|
|
2158 let line = getline(n)
|
|
2159 if line =~ '<!DOCTYPE.*DocBook'
|
|
2160 let b:docbk_type = "xml"
|
|
2161 setf docbk
|
|
2162 return
|
|
2163 endif
|
|
2164 if line =~ 'xmlns:xbl="http://www.mozilla.org/xbl"'
|
|
2165 setf xbl
|
|
2166 return
|
|
2167 endif
|
|
2168 let n += 1
|
|
2169 endwhile
|
|
2170 setf xml
|
|
2171 endfunc
|
7
|
2172
|
|
2173 " XMI (holding UML models) is also XML
|
|
2174 au BufNewFile,BufRead *.xmi setf xml
|
|
2175
|
|
2176 " CSPROJ files are Visual Studio.NET's XML-based project config files
|
|
2177 au BufNewFile,BufRead *.csproj,*.csproj.user setf xml
|
|
2178
|
|
2179 " Qt Linguist translation source and Qt User Interface Files are XML
|
|
2180 au BufNewFile,BufRead *.ts,*.ui setf xml
|
|
2181
|
1125
|
2182 " TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull)
|
|
2183 au BufNewFile,BufRead *.tpm setf xml
|
|
2184
|
389
|
2185 " Xdg menus
|
|
2186 au BufNewFile,BufRead /etc/xdg/menus/*.menu setf xml
|
|
2187
|
1648
|
2188 " ATI graphics driver configuration
|
|
2189 au BufNewFile,BufRead fglrxrc setf xml
|
|
2190
|
|
2191 " XLIFF (XML Localisation Interchange File Format) is also XML
|
|
2192 au BufNewFile,BufRead *.xlf setf xml
|
|
2193 au BufNewFile,BufRead *.xliff setf xml
|
|
2194
|
|
2195 " X11 xmodmap (also see below)
|
|
2196 au BufNewFile,BufRead *Xmodmap setf xmodmap
|
|
2197
|
419
|
2198 " Xquery
|
|
2199 au BufNewFile,BufRead *.xq,*.xql,*.xqm,*.xquery,*.xqy setf xquery
|
|
2200
|
7
|
2201 " XSD
|
|
2202 au BufNewFile,BufRead *.xsd setf xsd
|
|
2203
|
|
2204 " Xslt
|
|
2205 au BufNewFile,BufRead *.xsl,*.xslt setf xslt
|
|
2206
|
|
2207 " Yacc
|
375
|
2208 au BufNewFile,BufRead *.yy setf yacc
|
|
2209
|
|
2210 " Yacc or racc
|
|
2211 au BufNewFile,BufRead *.y call s:FTy()
|
|
2212
|
1219
|
2213 func! s:FTy()
|
375
|
2214 let n = 1
|
484
|
2215 while n < 100 && n < line("$")
|
|
2216 let line = getline(n)
|
|
2217 if line =~ '^\s*%'
|
|
2218 setf yacc
|
|
2219 return
|
|
2220 endif
|
482
|
2221 if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include'
|
375
|
2222 setf racc
|
|
2223 return
|
|
2224 endif
|
|
2225 let n = n + 1
|
|
2226 endwhile
|
|
2227 setf yacc
|
1219
|
2228 endfunc
|
375
|
2229
|
7
|
2230
|
|
2231 " Yaml
|
|
2232 au BufNewFile,BufRead *.yaml,*.yml setf yaml
|
|
2233
|
809
|
2234 " Zope
|
|
2235 " dtml (zope dynamic template markup language), pt (zope page template),
|
|
2236 " cpt (zope form controller page template)
|
826
|
2237 au BufNewFile,BufRead *.dtml,*.pt,*.cpt call s:FThtml()
|
809
|
2238 " zsql (zope sql method)
|
|
2239 au BufNewFile,BufRead *.zsql call s:SQL()
|
|
2240
|
7
|
2241 " Z80 assembler asz80
|
|
2242 au BufNewFile,BufRead *.z8a setf z8a
|
|
2243
|
|
2244 augroup END
|
|
2245
|
|
2246
|
|
2247 " Source the user-specified filetype file, for backwards compatibility with
|
|
2248 " Vim 5.x.
|
216
|
2249 if exists("myfiletypefile") && filereadable(expand(myfiletypefile))
|
7
|
2250 execute "source " . myfiletypefile
|
|
2251 endif
|
|
2252
|
|
2253
|
|
2254 " Check for "*" after loading myfiletypefile, so that scripts.vim is only used
|
|
2255 " when there are no matching file name extensions.
|
|
2256 " Don't do this for compressed files.
|
|
2257 augroup filetypedetect
|
|
2258 au BufNewFile,BufRead *
|
|
2259 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
|
|
2260 \ | runtime! scripts.vim | endif
|
|
2261 au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif
|
|
2262
|
|
2263
|
|
2264 " Extra checks for when no filetype has been detected now. Mostly used for
|
|
2265 " patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim
|
|
2266 " script file.
|
216
|
2267 " Most of these should call s:StarSetf() to avoid names ending in .gz and the
|
|
2268 " like are used.
|
7
|
2269
|
1668
|
2270 " More Apache files.
|
|
2271 au BufNewFile,BufRead /etc/apache2/conf.*/*,/etc/apache2/sites-*/*,/etc/apache2/mods-*/* call s:StarSetf('apache')
|
|
2272
|
531
|
2273 " Asterisk config file
|
856
|
2274 au BufNewFile,BufRead *asterisk/*.conf* call s:StarSetf('asterisk')
|
794
|
2275 au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm')
|
531
|
2276
|
1125
|
2277 " Bazaar version control
|
|
2278 au BufNewFile,BufRead bzr_log.* setf bzr
|
|
2279
|
7
|
2280 " BIND zone
|
805
|
2281 au BufNewFile,BufRead */named/db.*,*/bind/db.* call s:StarSetf('bindzone')
|
7
|
2282
|
|
2283 " Changelog
|
216
|
2284 au BufNewFile,BufRead [cC]hange[lL]og*
|
|
2285 \ if getline(1) =~ '; urgency='
|
|
2286 \| call s:StarSetf('debchangelog')
|
|
2287 \|else
|
|
2288 \| call s:StarSetf('changelog')
|
|
2289 \|endif
|
7
|
2290
|
|
2291 " Crontab
|
1668
|
2292 au BufNewFile,BufRead crontab,crontab.*,/etc/cron.d/* call s:StarSetf('crontab')
|
7
|
2293
|
816
|
2294 " Debian Sources.list
|
|
2295 au BufNewFile,BufRead /etc/apt/sources.list.d/* call s:StarSetf('debsources')
|
|
2296
|
7
|
2297 " Dracula
|
216
|
2298 au BufNewFile,BufRead drac.* call s:StarSetf('dracula')
|
7
|
2299
|
|
2300 " Fvwm
|
1125
|
2301 au BufNewFile,BufRead */.fvwm/* call s:StarSetf('fvwm')
|
7
|
2302 au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook
|
216
|
2303 \ let b:fvwm_version = 1 | call s:StarSetf('fvwm')
|
7
|
2304 au BufNewFile,BufRead *fvwm2rc*
|
216
|
2305 \ if expand("<afile>:e") == "m4"
|
|
2306 \| call s:StarSetf('fvwm2m4')
|
|
2307 \|else
|
|
2308 \| let b:fvwm_version = 2 | call s:StarSetf('fvwm')
|
|
2309 \|endif
|
7
|
2310
|
|
2311 " GTK RC
|
216
|
2312 au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc')
|
7
|
2313
|
|
2314 " Jam
|
216
|
2315 au BufNewFile,BufRead Prl*.*,JAM*.* call s:StarSetf('jam')
|
7
|
2316
|
|
2317 " Jargon
|
|
2318 au! BufNewFile,BufRead *jarg*
|
216
|
2319 \ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE'
|
|
2320 \| call s:StarSetf('jargon')
|
|
2321 \|endif
|
7
|
2322
|
837
|
2323 " Kconfig
|
|
2324 au BufNewFile,BufRead Kconfig.* call s:StarSetf('kconfig')
|
|
2325
|
7
|
2326 " Makefile
|
216
|
2327 au BufNewFile,BufRead [mM]akefile* call s:StarSetf('make')
|
7
|
2328
|
1648
|
2329 " Ruby Makefile
|
|
2330 au BufNewFile,BufRead [rR]akefile* call s:StarSetf('ruby')
|
|
2331
|
|
2332 " Mail (also matches muttrc.vim, so this is below the other checks)
|
|
2333 au BufNewFile,BufRead mutt[[:alnum:]._-]\{6\} setf mail
|
|
2334
|
389
|
2335 " Modconf
|
|
2336 au BufNewFile,BufRead /etc/modprobe.* call s:StarSetf('modconf')
|
|
2337
|
7
|
2338 " Mutt setup file
|
1648
|
2339 au BufNewFile,BufRead .mutt{ng,}rc*,*/.mutt{ng,}/mutt{ng,}rc* call s:StarSetf('muttrc')
|
484
|
2340 au BufNewFile,BufRead mutt{ng,}rc*,Mutt{ng,}rc* call s:StarSetf('muttrc')
|
7
|
2341
|
|
2342 " Nroff macros
|
216
|
2343 au BufNewFile,BufRead tmac.* call s:StarSetf('nroff')
|
7
|
2344
|
375
|
2345 " Pam conf
|
|
2346 au BufNewFile,BufRead /etc/pam.d/* call s:StarSetf('pamconf')
|
|
2347
|
7
|
2348 " Printcap and Termcap
|
|
2349 au BufNewFile,BufRead *printcap*
|
216
|
2350 \ if !did_filetype()
|
|
2351 \| let b:ptcap_type = "print" | call s:StarSetf('ptcap')
|
|
2352 \|endif
|
7
|
2353 au BufNewFile,BufRead *termcap*
|
216
|
2354 \ if !did_filetype()
|
|
2355 \| let b:ptcap_type = "term" | call s:StarSetf('ptcap')
|
|
2356 \|endif
|
7
|
2357
|
|
2358 " Vim script
|
216
|
2359 au BufNewFile,BufRead *vimrc* call s:StarSetf('vim')
|
7
|
2360
|
|
2361 " Subversion commit file
|
45
|
2362 au BufNewFile,BufRead svn-commit*.tmp setf svn
|
7
|
2363
|
|
2364 " X resources file
|
216
|
2365 au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* call s:StarSetf('xdefaults')
|
7
|
2366
|
|
2367 " XFree86 config
|
|
2368 au BufNewFile,BufRead XF86Config-4*
|
216
|
2369 \ let b:xf86c_xfree86_version = 4 | call s:StarSetf('xf86conf')
|
7
|
2370 au BufNewFile,BufRead XF86Config*
|
216
|
2371 \ if getline(1) =~ '\<XConfigurator\>'
|
|
2372 \| let b:xf86c_xfree86_version = 3
|
|
2373 \|endif
|
|
2374 \|call s:StarSetf('xf86conf')
|
7
|
2375
|
|
2376 " X11 xmodmap
|
216
|
2377 au BufNewFile,BufRead *xmodmap* call s:StarSetf('xmodmap')
|
7
|
2378
|
375
|
2379 " Xinetd conf
|
|
2380 au BufNewFile,BufRead /etc/xinetd.d/* call s:StarSetf('xinetd')
|
|
2381
|
7
|
2382 " Z-Shell script
|
216
|
2383 au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh')
|
7
|
2384
|
|
2385
|
|
2386 " Generic configuration file (check this last, it's just guessing!)
|
|
2387 au BufNewFile,BufRead,StdinReadPost *
|
|
2388 \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
|
|
2389 \ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
|
|
2390 \ || getline(4) =~ '^#' || getline(5) =~ '^#') |
|
|
2391 \ setf conf |
|
|
2392 \ endif
|
|
2393
|
|
2394 " Use the plugin-filetype checks last, they may overrule any of the previously
|
|
2395 " detected filetypes.
|
|
2396 runtime! ftdetect/*.vim
|
|
2397
|
|
2398 augroup END
|
|
2399
|
|
2400
|
|
2401 " If the GUI is already running, may still need to install the Syntax menu.
|
|
2402 " Don't do it when the 'M' flag is included in 'guioptions'.
|
|
2403 if has("menu") && has("gui_running")
|
|
2404 \ && !exists("did_install_syntax_menu") && &guioptions !~# "M"
|
|
2405 source <sfile>:p:h/menu.vim
|
|
2406 endif
|
|
2407
|
1219
|
2408 " Function called for testing all functions defined here. These are
|
|
2409 " script-local, thus need to be executed here.
|
|
2410 " Returns a string with error messages (hopefully empty).
|
|
2411 func! TestFiletypeFuncs(testlist)
|
|
2412 let output = ''
|
|
2413 for f in a:testlist
|
|
2414 try
|
|
2415 exe f
|
|
2416 catch
|
|
2417 let output = output . "\n" . f . ": " . v:exception
|
|
2418 endtry
|
|
2419 endfor
|
|
2420 return output
|
|
2421 endfunc
|
|
2422
|
7
|
2423 " Restore 'cpoptions'
|
|
2424 let &cpo = s:cpo_save
|
|
2425 unlet s:cpo_save
|