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