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