annotate runtime/scripts.vim @ 2610:6c05b5e5c1be v7.3.032

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