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