RailsEditor 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +20 -0
- data/README.rails-editor +41 -0
- data/bin/RailsEditor +6 -0
- data/lib/rails-editor.rb +33 -0
- data/rails/.vim/filetype.vim +1741 -0
- data/rails/.vim/syntax/eruby.vim +40 -0
- data/rails/.vimrc +8 -0
- data/rails/README.rails-editor +36 -0
- data/rails/config/.screenrc.code.erb +28 -0
- data/rails/script/editor +137 -0
- data/tests/ts_rails_editor.rb +1 -0
- metadata +66 -0
data/INSTALL
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
REQUIRES:
|
2
|
+
screen
|
3
|
+
vim (must be vim that supports directory browsing)
|
4
|
+
rubygems
|
5
|
+
rails rubygem
|
6
|
+
rake
|
7
|
+
|
8
|
+
to install:
|
9
|
+
build the gem if it doesn't already exist, with
|
10
|
+
rake pkg/RailsEditor-$VERSION.gem
|
11
|
+
install the gem
|
12
|
+
gem install pkg/RailsEditor-$VERSION.gem
|
13
|
+
|
14
|
+
CD to a RAILS_ROOT
|
15
|
+
run RailsEditor
|
16
|
+
|
17
|
+
In that RAILS_ROOT, there will be a .vimrc that you can adjust to your liking,
|
18
|
+
it will use this instead of your regular ~/.vimrc
|
19
|
+
|
20
|
+
See README.rails-editor for licensing and more complete usage.
|
data/README.rails-editor
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
Copyright 2005, by The Rubyists (bougyman,trey,deathsyn)*
|
2
|
+
Licensed under the Gnu Public License, which should be
|
3
|
+
included in licence/GPL.txt.
|
4
|
+
|
5
|
+
If you did not receive this licence file you can contact the author
|
6
|
+
for a copy at bougy dot man at gmail dot com, or see the latest
|
7
|
+
version at http://www.gnu.org/copyleft/gpl.html.
|
8
|
+
|
9
|
+
This is a little command wrapper for screen + vim to give
|
10
|
+
you a nice IDE session for rails development. Console junkies
|
11
|
+
should like it, but through the use of Escreen it can be
|
12
|
+
GUI friendly as well.
|
13
|
+
|
14
|
+
After installing the gem, change to a rails_root and run the command:
|
15
|
+
RailsEditor
|
16
|
+
|
17
|
+
The gem install should have linked RailsEditor to a location in your run path
|
18
|
+
Then you'll have ./script/editor available
|
19
|
+
|
20
|
+
./script/editor -? for usage (from the RAILS_ROOT).
|
21
|
+
|
22
|
+
BASIC USAGE
|
23
|
+
|
24
|
+
This is most likely only useful for console junkies, but may help for
|
25
|
+
any vim user in a pinch that has to make console edits (ssh or what-not).
|
26
|
+
|
27
|
+
On startup you'll have a variety of windows set up for rails development.
|
28
|
+
Many will have VIM sessions in File Browser mode, others will be shells dedicated
|
29
|
+
to a certain task. In Screen 1 you'll have a ./script/console session that
|
30
|
+
will restart itself on exit. The ide gets more powerful for experienced 'screen'
|
31
|
+
users with split screen modes and other goodies.
|
32
|
+
|
33
|
+
SPLIT SCREEN
|
34
|
+
|
35
|
+
A new caption line will appear when you split screens in 'screen' (ctrl-a S). At
|
36
|
+
this time there is no way to remove the hardstatus global statusline automatically,
|
37
|
+
so i've bound F8 and F9 to turning on and off (respectively) the hardstatus line
|
38
|
+
to avoid duplicate statusbars.
|
39
|
+
|
40
|
+
* tj vanderpoel,trey dempsey,kevin berry
|
41
|
+
|
data/bin/RailsEditor
ADDED
data/lib/rails-editor.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
EDITOR_LIB_HOME = File.expand_path(File.dirname(__FILE__) + "/../")
|
2
|
+
require "rubygems"
|
3
|
+
require "rake/gempackagetask"
|
4
|
+
class RailsEditor
|
5
|
+
attr_accessor :rails_root
|
6
|
+
def initialize(args = {:rails_root => ENV['PWD']})
|
7
|
+
@rails_root = args[:rails_root]
|
8
|
+
end
|
9
|
+
|
10
|
+
def create
|
11
|
+
rails_home = EDITOR_LIB_HOME + "/rails"
|
12
|
+
files = FileList[rails_home + "/**/*"].to_a
|
13
|
+
files += FileList[rails_home + "/.vim/**/*"]
|
14
|
+
files += [rails_home + "/.vimrc",rails_home + "/config/.screenrc.code.erb"]
|
15
|
+
files.to_a.each do |editor_file|
|
16
|
+
save_dir = @rails_root + File.dirname(editor_file.split(rails_home)[1])
|
17
|
+
if FileTest.directory?(editor_file)
|
18
|
+
if not File.exists?(save_dir)
|
19
|
+
puts 'Dir.mkdir("' + save_dir + '")'
|
20
|
+
Dir.mkdir(save_dir)
|
21
|
+
end
|
22
|
+
next
|
23
|
+
end
|
24
|
+
if not File.exists?(save_dir) or not FileTest.directory?(save_dir)
|
25
|
+
puts "Dir.mkdir(" + save_dir + ") "
|
26
|
+
Dir.mkdir(save_dir)
|
27
|
+
end
|
28
|
+
puts "File.cp(" + editor_file + "," + save_dir + "/" + File.basename(editor_file) + ") "
|
29
|
+
File.cp(editor_file,save_dir + "/" + File.basename(editor_file))
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,1741 @@
|
|
1
|
+
" Vim support file to detect file types
|
2
|
+
"
|
3
|
+
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
4
|
+
" Last Change: 2004 May 30
|
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
|
19
|
+
au BufNewFile,BufRead *.orig,*.bak,*.old,*.new,*.rpmsave,*.rpmnew
|
20
|
+
\ exe "doau filetypedetect BufRead " . expand("<afile>:r")
|
21
|
+
au BufNewFile,BufRead *~
|
22
|
+
\ let s:name = expand("<afile>") |
|
23
|
+
\ let s:short = substitute(s:name, '\~$', '', '') |
|
24
|
+
\ if s:name != s:short && s:short != "" |
|
25
|
+
\ exe "doau filetypedetect BufRead " . s:short |
|
26
|
+
\ endif |
|
27
|
+
\ unlet s:name |
|
28
|
+
\ unlet s:short
|
29
|
+
au BufNewFile,BufRead *.in
|
30
|
+
\ if expand("<afile>:t") != "configure.in" |
|
31
|
+
\ exe "doau filetypedetect BufRead " . expand("<afile>:r") |
|
32
|
+
\ endif
|
33
|
+
|
34
|
+
" Pattern used to match file names which should not be inspected.
|
35
|
+
" Currently finds compressed files.
|
36
|
+
if !exists("g:ft_ignore_pat")
|
37
|
+
let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
|
38
|
+
endif
|
39
|
+
|
40
|
+
" Abaqus or Trasys
|
41
|
+
au BufNewFile,BufRead *.inp call FTCheck_inp()
|
42
|
+
|
43
|
+
fun! FTCheck_inp()
|
44
|
+
if getline(1) =~ '^\*'
|
45
|
+
setf abaqus
|
46
|
+
else
|
47
|
+
let n = 1
|
48
|
+
if line("$") > 500
|
49
|
+
let nmax = 500
|
50
|
+
else
|
51
|
+
let nmax = line("$")
|
52
|
+
endif
|
53
|
+
while n <= nmax
|
54
|
+
if getline(n) =~? "^header surface data"
|
55
|
+
setf trasys
|
56
|
+
break
|
57
|
+
endif
|
58
|
+
let n = n + 1
|
59
|
+
endwhile
|
60
|
+
endif
|
61
|
+
endfun
|
62
|
+
|
63
|
+
" A-A-P recipe
|
64
|
+
au BufNewFile,BufRead *.aap setf aap
|
65
|
+
|
66
|
+
" ABC music notation
|
67
|
+
au BufNewFile,BufRead *.abc setf abc
|
68
|
+
|
69
|
+
" ABEL
|
70
|
+
au BufNewFile,BufRead *.abl setf abel
|
71
|
+
|
72
|
+
" AceDB
|
73
|
+
au BufNewFile,BufRead *.wrm setf acedb
|
74
|
+
|
75
|
+
" Ada (83, 9X, 95)
|
76
|
+
au BufNewFile,BufRead *.adb,*.ads,*.ada setf ada
|
77
|
+
|
78
|
+
" AHDL
|
79
|
+
au BufNewFile,BufRead *.tdf setf ahdl
|
80
|
+
|
81
|
+
" AMPL
|
82
|
+
au BufNewFile,BufRead *.run setf ampl
|
83
|
+
|
84
|
+
" Ant
|
85
|
+
au BufNewFile,BufRead build.xml setf ant
|
86
|
+
|
87
|
+
" Apache style config file
|
88
|
+
au BufNewFile,BufRead proftpd.conf* setf apachestyle
|
89
|
+
|
90
|
+
" Apache config file
|
91
|
+
au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,.htaccess,apache.conf* setf apache
|
92
|
+
|
93
|
+
" XA65 MOS6510 cross assembler
|
94
|
+
au BufNewFile,BufRead *.a65 setf a65
|
95
|
+
|
96
|
+
" Applix ELF
|
97
|
+
au BufNewFile,BufRead *.am
|
98
|
+
\ if expand("<afile>") !~? 'Makefile.am\>' | setf elf | endif
|
99
|
+
|
100
|
+
" Arc Macro Language
|
101
|
+
au BufNewFile,BufRead *.aml setf aml
|
102
|
+
|
103
|
+
" Arch Inventory file
|
104
|
+
au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch
|
105
|
+
|
106
|
+
" ART*Enterprise (formerly ART-IM)
|
107
|
+
au BufNewFile,BufRead *.art setf art
|
108
|
+
|
109
|
+
" ASN.1
|
110
|
+
au BufNewFile,BufRead *.asn,*.asn1 setf asn
|
111
|
+
|
112
|
+
" Active Server Pages (with Visual Basic Script)
|
113
|
+
au BufNewFile,BufRead *.asa
|
114
|
+
\ if exists("g:filetype_asa") |
|
115
|
+
\ exe "setf " . g:filetype_asa |
|
116
|
+
\ else |
|
117
|
+
\ setf aspvbs |
|
118
|
+
\ endif
|
119
|
+
|
120
|
+
" Active Server Pages (with Perl or Visual Basic Script)
|
121
|
+
au BufNewFile,BufRead *.asp
|
122
|
+
\ if exists("g:filetype_asp") |
|
123
|
+
\ exe "setf " . g:filetype_asp |
|
124
|
+
\ elseif getline(1) . getline(2) . getline(3) =~? "perlscript" |
|
125
|
+
\ setf aspperl |
|
126
|
+
\ else |
|
127
|
+
\ setf aspvbs |
|
128
|
+
\ endif
|
129
|
+
|
130
|
+
" Grub (must be before catch *.lst)
|
131
|
+
au BufNewFile,BufRead /boot/grub/menu.lst,/boot/grub/grub.conf setf grub
|
132
|
+
|
133
|
+
" Assembly (all kinds)
|
134
|
+
" *.lst is not pure assembly, it has two extra columns (address, byte codes)
|
135
|
+
au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call <SID>FTasm()
|
136
|
+
|
137
|
+
" This function checks for the kind of assembly that is wanted by the user, or
|
138
|
+
" can be detected from the first five lines of the file.
|
139
|
+
fun! <SID>FTasm()
|
140
|
+
" make sure b:asmsyntax exists
|
141
|
+
if !exists("b:asmsyntax")
|
142
|
+
let b:asmsyntax = ""
|
143
|
+
endif
|
144
|
+
|
145
|
+
if b:asmsyntax == ""
|
146
|
+
call FTCheck_asmsyntax()
|
147
|
+
endif
|
148
|
+
|
149
|
+
" if b:asmsyntax still isn't set, default to asmsyntax or GNU
|
150
|
+
if b:asmsyntax == ""
|
151
|
+
if exists("g:asmsyntax")
|
152
|
+
let b:asmsyntax = g:asmsyntax
|
153
|
+
else
|
154
|
+
let b:asmsyntax = "asm"
|
155
|
+
endif
|
156
|
+
endif
|
157
|
+
|
158
|
+
exe "setf " . b:asmsyntax
|
159
|
+
endfun
|
160
|
+
|
161
|
+
fun! FTCheck_asmsyntax()
|
162
|
+
" see if file contains any asmsyntax=foo overrides. If so, change
|
163
|
+
" b:asmsyntax appropriately
|
164
|
+
let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4).
|
165
|
+
\" ".getline(5)." "
|
166
|
+
if head =~ '\sasmsyntax=\S\+\s'
|
167
|
+
let b:asmsyntax = substitute(head, '.*\sasmsyntax=\(\S\+\)\s.*','\1', "")
|
168
|
+
elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library'))
|
169
|
+
let b:asmsyntax = "vmasm"
|
170
|
+
endif
|
171
|
+
endfun
|
172
|
+
|
173
|
+
" Macro (VAX)
|
174
|
+
au BufNewFile,BufRead *.mar setf vmasm
|
175
|
+
|
176
|
+
" Atlas
|
177
|
+
au BufNewFile,BufRead *.atl,*.as setf atlas
|
178
|
+
|
179
|
+
" Automake
|
180
|
+
au BufNewFile,BufRead [mM]akefile.am setf automake
|
181
|
+
|
182
|
+
" Avenue
|
183
|
+
au BufNewFile,BufRead *.ave setf ave
|
184
|
+
|
185
|
+
" Awk
|
186
|
+
au BufNewFile,BufRead *.awk setf awk
|
187
|
+
|
188
|
+
" B
|
189
|
+
au BufNewFile,BufRead *.mch,*.ref,*.imp setf b
|
190
|
+
|
191
|
+
" BASIC or Visual Basic
|
192
|
+
au BufNewFile,BufRead *.bas call <SID>FTVB("basic")
|
193
|
+
|
194
|
+
" Check if one of the first five lines contains "VB_Name". In that case it is
|
195
|
+
" probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype.
|
196
|
+
fun! <SID>FTVB(alt)
|
197
|
+
if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
|
198
|
+
setf vb
|
199
|
+
else
|
200
|
+
exe "setf " . a:alt
|
201
|
+
endif
|
202
|
+
endfun
|
203
|
+
|
204
|
+
" Visual Basic Script (close to Visual Basic)
|
205
|
+
au BufNewFile,BufRead *.vbs,*.dsm,*.ctl setf vb
|
206
|
+
|
207
|
+
" Batch file for MSDOS.
|
208
|
+
au BufNewFile,BufRead *.bat,*.btm,*.sys setf dosbatch
|
209
|
+
" *.cmd is close to a Batch file, but on OS/2 Rexx files also use *.cmd.
|
210
|
+
au BufNewFile,BufRead *.cmd
|
211
|
+
\ if getline(1) =~ '^/\*' | setf rexx | else | setf dosbatch | endif
|
212
|
+
|
213
|
+
" Batch file for 4DOS
|
214
|
+
au BufNewFile,BufRead *.btm setf btm
|
215
|
+
|
216
|
+
" BC calculator
|
217
|
+
au BufNewFile,BufRead *.bc setf bc
|
218
|
+
|
219
|
+
" BDF font
|
220
|
+
au BufNewFile,BufRead *.bdf setf bdf
|
221
|
+
|
222
|
+
" BibTeX bibliography database file
|
223
|
+
au BufNewFile,BufRead *.bib setf bib
|
224
|
+
|
225
|
+
" BIND configuration
|
226
|
+
au BufNewFile,BufRead named.conf setf named
|
227
|
+
|
228
|
+
" BIND zone
|
229
|
+
au BufNewFile,BufRead named.root setf bindzone
|
230
|
+
|
231
|
+
" Blank
|
232
|
+
au BufNewFile,BufRead *.bl setf blank
|
233
|
+
|
234
|
+
" C or lpc
|
235
|
+
au BufNewFile,BufRead *.c call <SID>FTlpc()
|
236
|
+
|
237
|
+
fun! <SID>FTlpc()
|
238
|
+
if exists("g:lpc_syntax_for_c")
|
239
|
+
let lnum = 1
|
240
|
+
while lnum <= 12
|
241
|
+
if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)'
|
242
|
+
setf lpc
|
243
|
+
return
|
244
|
+
endif
|
245
|
+
let lnum = lnum + 1
|
246
|
+
endwhile
|
247
|
+
endif
|
248
|
+
setf c
|
249
|
+
endfun
|
250
|
+
|
251
|
+
" Calendar
|
252
|
+
au BufNewFile,BufRead calendar,~/.calendar/*,
|
253
|
+
\*/share/calendar/*/calendar.*,*/share/calendar/calendar.*
|
254
|
+
\ setf calendar
|
255
|
+
|
256
|
+
" C#
|
257
|
+
au BufNewFile,BufRead *.cs setf cs
|
258
|
+
|
259
|
+
" Comshare Dimension Definition Language
|
260
|
+
au BufNewFile,BufRead *.cdl setf cdl
|
261
|
+
|
262
|
+
" Controllable Regex Mutilator
|
263
|
+
au BufNewFile,BufRead *.crm setf crm
|
264
|
+
|
265
|
+
" Cyn++
|
266
|
+
au BufNewFile,BufRead *.cyn setf cynpp
|
267
|
+
|
268
|
+
" Cynlib
|
269
|
+
" .cc and .cpp files can be C++ or Cynlib.
|
270
|
+
au BufNewFile,BufRead *.cc
|
271
|
+
\ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cpp|endif
|
272
|
+
au BufNewFile,BufRead *.cpp
|
273
|
+
\ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif
|
274
|
+
|
275
|
+
" C++
|
276
|
+
if has("fname_case")
|
277
|
+
au BufNewFile,BufRead *.cxx,*.c++,*.C,*.H,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp
|
278
|
+
else
|
279
|
+
au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp
|
280
|
+
endif
|
281
|
+
|
282
|
+
" .h files can be C, Ch or C++, set c_syntax_for_h if you want C,
|
283
|
+
" ch_syntax_for_h if you want Ch.
|
284
|
+
au BufNewFile,BufRead *.h
|
285
|
+
\ if exists("c_syntax_for_h") | setf c |
|
286
|
+
\ elseif exists("ch_syntax_for_h") | setf ch |
|
287
|
+
\ else | setf cpp | endif
|
288
|
+
|
289
|
+
" Ch (CHscript)
|
290
|
+
au BufNewFile,BufRead *.chf setf ch
|
291
|
+
|
292
|
+
" TLH files are C++ headers generated by Visual C++'s #import from typelibs
|
293
|
+
au BufNewFile,BufRead *.tlh setf cpp
|
294
|
+
|
295
|
+
" Cascading Style Sheets
|
296
|
+
au BufNewFile,BufRead *.css setf css
|
297
|
+
|
298
|
+
" Century Term Command Scripts (*.cmd too)
|
299
|
+
au BufNewFile,BufRead *.con setf cterm
|
300
|
+
|
301
|
+
" Changelog
|
302
|
+
au BufNewFile,BufRead changelog.Debian,changelog.dch setf debchangelog
|
303
|
+
au BufNewFile,BufRead [cC]hange[lL]og if getline(1) =~ '; urgency='
|
304
|
+
\| setf debchangelog | else | setf changelog | endif
|
305
|
+
|
306
|
+
" CHILL
|
307
|
+
au BufNewFile,BufRead *..ch setf chill
|
308
|
+
|
309
|
+
" Changes for WEB and CWEB or CHILL
|
310
|
+
au BufNewFile,BufRead *.ch call <SID>FTchange()
|
311
|
+
|
312
|
+
" This function checks if one of the first ten lines start with a '@'. In
|
313
|
+
" that case it is probably a change file.
|
314
|
+
" If the first line starts with # or ! it's probably a ch file.
|
315
|
+
" If a line has "main", "include", "//" ir "/*" it's probably ch.
|
316
|
+
" Otherwise CHILL is assumed.
|
317
|
+
fun! <SID>FTchange()
|
318
|
+
let lnum = 1
|
319
|
+
while lnum <= 10
|
320
|
+
if getline(lnum)[0] == '@'
|
321
|
+
setf change
|
322
|
+
return
|
323
|
+
endif
|
324
|
+
if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!')
|
325
|
+
setf ch
|
326
|
+
return
|
327
|
+
endif
|
328
|
+
if getline(lnum) =~ "MODULE"
|
329
|
+
setf chill
|
330
|
+
return
|
331
|
+
endif
|
332
|
+
if getline(lnum) =~ 'main\s*(\|#\s*include\|//'
|
333
|
+
setf ch
|
334
|
+
return
|
335
|
+
endif
|
336
|
+
let lnum = lnum + 1
|
337
|
+
endwhile
|
338
|
+
setf chill
|
339
|
+
endfun
|
340
|
+
|
341
|
+
" Clean
|
342
|
+
au BufNewFile,BufRead *.dcl,*.icl setf clean
|
343
|
+
|
344
|
+
" Clever
|
345
|
+
au BufNewFile,BufRead *.eni setf cl
|
346
|
+
|
347
|
+
" Clever or dtd
|
348
|
+
au BufNewFile,BufRead *.ent call <SID>FTent()
|
349
|
+
|
350
|
+
fun! <SID>FTent()
|
351
|
+
" This function checks for valid cl syntax in the first five lines.
|
352
|
+
" Look for either an opening comment, '#', or a block start, '{".
|
353
|
+
" If not found, assume SGML.
|
354
|
+
let lnum = 1
|
355
|
+
while lnum < 6
|
356
|
+
let line = getline(lnum)
|
357
|
+
if line =~ '^\s*[#{]'
|
358
|
+
setf cl
|
359
|
+
return
|
360
|
+
elseif line !~ '^\s*$'
|
361
|
+
" Not a blank line, not a comment, and not a block start,
|
362
|
+
" so doesn't look like valid cl code.
|
363
|
+
break
|
364
|
+
endif
|
365
|
+
let lnum = lnum + 1
|
366
|
+
endw
|
367
|
+
setf dtd
|
368
|
+
endfun
|
369
|
+
|
370
|
+
" Clipper (or FoxPro)
|
371
|
+
au BufNewFile,BufRead *.prg
|
372
|
+
\ if exists("g:filetype_prg") |
|
373
|
+
\ exe "setf " . g:filetype_prg |
|
374
|
+
\ else |
|
375
|
+
\ setf clipper |
|
376
|
+
\ endif
|
377
|
+
|
378
|
+
" Cobol
|
379
|
+
au BufNewFile,BufRead *.cbl,*.cob,*.cpy,*.lib setf cobol
|
380
|
+
|
381
|
+
" Cold Fusion
|
382
|
+
au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf
|
383
|
+
|
384
|
+
" Configure scripts
|
385
|
+
au BufNewFile,BufRead configure.in,configure.ac setf config
|
386
|
+
|
387
|
+
" WildPackets EtherPeek Decoder
|
388
|
+
au BufNewFile,BufRead *.dcd setf dcd
|
389
|
+
|
390
|
+
" Enlightenment configuration files
|
391
|
+
au BufNewFile,BufRead *enlightenment/*.cfg setf c
|
392
|
+
|
393
|
+
" Eterm
|
394
|
+
au BufNewFile,BufRead *Eterm/*.cfg setf eterm
|
395
|
+
|
396
|
+
" Lynx config files
|
397
|
+
au BufNewFile,BufRead lynx.cfg setf lynx
|
398
|
+
|
399
|
+
" Quake
|
400
|
+
au BufNewFile,BufRead *baseq[2-3]/*.cfg,*id1/*.cfg setf quake
|
401
|
+
au BufNewFile,BufRead *quake[1-3]/*.cfg setf quake
|
402
|
+
|
403
|
+
" Quake C
|
404
|
+
au BufNewFile,BufRead *.qc setf c
|
405
|
+
|
406
|
+
" Configure files
|
407
|
+
au BufNewFile,BufRead *.cfg setf cfg
|
408
|
+
|
409
|
+
" Communicating Sequential Processes
|
410
|
+
au BufNewFile,BufRead *.csp,*.fdr setf csp
|
411
|
+
|
412
|
+
" CUPL logic description and simulation
|
413
|
+
au BufNewFile,BufRead *.pld setf cupl
|
414
|
+
au BufNewFile,BufRead *.si setf cuplsim
|
415
|
+
|
416
|
+
" Debian Control
|
417
|
+
au BufNewFile,BufRead */debian/control setf debcontrol
|
418
|
+
|
419
|
+
" ROCKLinux package description
|
420
|
+
au BufNewFile,BufRead *.desc setf desc
|
421
|
+
|
422
|
+
" the D language
|
423
|
+
au BufNewFile,BufRead *.d setf d
|
424
|
+
|
425
|
+
" Desktop files
|
426
|
+
au BufNewFile,BufRead *.desktop,.directory setf desktop
|
427
|
+
|
428
|
+
" Diff files
|
429
|
+
au BufNewFile,BufRead *.diff,*.rej,*.patch setf diff
|
430
|
+
|
431
|
+
" Dircolors
|
432
|
+
au BufNewFile,BufRead .dir_colors,/etc/DIR_COLORS setf dircolors
|
433
|
+
|
434
|
+
" Diva (with Skill) or InstallShield
|
435
|
+
au BufNewFile,BufRead *.rul
|
436
|
+
\ if getline(1).getline(2).getline(3).getline(4).getline(5).getline(6) =~? 'InstallShield' |
|
437
|
+
\ setf ishd |
|
438
|
+
\ else |
|
439
|
+
\ setf diva |
|
440
|
+
\ endif
|
441
|
+
|
442
|
+
" DCL (Digital Command Language - vms) or DNS zone file
|
443
|
+
au BufNewFile,BufRead *.com
|
444
|
+
\ if getline(1).getline(2) =~ '$ORIGIN\|$TTL\|IN\s*SOA'
|
445
|
+
\ || getline(1).getline(2).getline(3).getline(4) =~ 'BIND.*named'
|
446
|
+
\ | setf dns | else | setf dcl | endif
|
447
|
+
|
448
|
+
" DOT
|
449
|
+
au BufNewFile,BufRead *.dot setf dot
|
450
|
+
|
451
|
+
" Dylan - lid files
|
452
|
+
au BufNewFile,BufRead *.lid setf dylanlid
|
453
|
+
|
454
|
+
" Dylan - intr files (melange)
|
455
|
+
au BufNewFile,BufRead *.intr setf dylanintr
|
456
|
+
|
457
|
+
" Dylan
|
458
|
+
au BufNewFile,BufRead *.dylan setf dylan
|
459
|
+
|
460
|
+
" Microsoft Module Definition
|
461
|
+
au BufNewFile,BufRead *.def setf def
|
462
|
+
|
463
|
+
" Dracula
|
464
|
+
au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula
|
465
|
+
|
466
|
+
" dsl
|
467
|
+
au BufNewFile,BufRead *.dsl setf dsl
|
468
|
+
|
469
|
+
" DTD (Document Type Definition for XML)
|
470
|
+
au BufNewFile,BufRead *.dtd setf dtd
|
471
|
+
|
472
|
+
" EDIF (*.edf,*.edif,*.edn,*.edo)
|
473
|
+
au BufNewFile,BufRead *.ed\(f\|if\|n\|o\) setf edif
|
474
|
+
|
475
|
+
" Embedix Component Description
|
476
|
+
au BufNewFile,BufRead *.ecd setf ecd
|
477
|
+
|
478
|
+
" Eiffel or Specman
|
479
|
+
au BufNewFile,BufRead *.e,*.E call FTCheck_e()
|
480
|
+
|
481
|
+
" Elinks configuration
|
482
|
+
au BufNewFile,BufRead */etc/elinks.conf,~/.elinks/elinks.conf setf elinks
|
483
|
+
|
484
|
+
fun! FTCheck_e()
|
485
|
+
let n = 1
|
486
|
+
while n < 100 && n < line("$")
|
487
|
+
if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
|
488
|
+
setf specman
|
489
|
+
return
|
490
|
+
endif
|
491
|
+
let n = n + 1
|
492
|
+
endwhile
|
493
|
+
setf eiffel
|
494
|
+
endfun
|
495
|
+
|
496
|
+
" ERicsson LANGuage
|
497
|
+
au BufNewFile,BufRead *.erl setf erlang
|
498
|
+
|
499
|
+
" Elm Filter Rules file
|
500
|
+
au BufNewFile,BufRead filter-rules setf elmfilt
|
501
|
+
|
502
|
+
" ESQL-C
|
503
|
+
au BufNewFile,BufRead *.ec,*.EC setf esqlc
|
504
|
+
|
505
|
+
" Essbase script
|
506
|
+
au BufNewFile,BufRead *.csc setf csc
|
507
|
+
|
508
|
+
" Exim
|
509
|
+
au BufNewFile,BufRead exim.conf setf exim
|
510
|
+
|
511
|
+
" Expect
|
512
|
+
au BufNewFile,BufRead *.exp setf expect
|
513
|
+
|
514
|
+
" Exports
|
515
|
+
au BufNewFile,BufRead exports setf exports
|
516
|
+
|
517
|
+
" Fetchmail RC file
|
518
|
+
au BufNewFile,BufRead .fetchmailrc setf fetchmail
|
519
|
+
|
520
|
+
" Focus Executable
|
521
|
+
au BufNewFile,BufRead *.fex,*.focexec setf focexec
|
522
|
+
|
523
|
+
" Focus Master file (but not for auto.master)
|
524
|
+
au BufNewFile,BufRead auto.master setf conf
|
525
|
+
au BufNewFile,BufRead *.mas,*.master setf master
|
526
|
+
|
527
|
+
" Forth
|
528
|
+
au BufNewFile,BufRead *.fs,*.ft setf forth
|
529
|
+
|
530
|
+
" Fortran
|
531
|
+
au BufNewFile,BufRead *.f,*.F,*.for,*.fpp,*.ftn,*.f77,*.F77,*.f90,*.F90,*.f95,*.F95 setf fortran
|
532
|
+
|
533
|
+
" FStab
|
534
|
+
au BufNewFile,BufRead fstab setf fstab
|
535
|
+
|
536
|
+
" GDB command files
|
537
|
+
au BufNewFile,BufRead .gdbinit setf gdb
|
538
|
+
|
539
|
+
" GDMO
|
540
|
+
au BufNewFile,BufRead *.mo,*.gdmo setf gdmo
|
541
|
+
|
542
|
+
" Gedcom
|
543
|
+
au BufNewFile,BufRead *.ged setf gedcom
|
544
|
+
|
545
|
+
" Gkrellmrc
|
546
|
+
au BufNewFile,BufRead gkrellmrc,gkrellmrc_? setf gkrellmrc
|
547
|
+
|
548
|
+
" GP scripts (2.0 and onward)
|
549
|
+
au BufNewFile,BufRead *.gp setf gp
|
550
|
+
|
551
|
+
" GPG
|
552
|
+
au BufNewFile,BufRead ~/.gnupg/options setf gpg
|
553
|
+
au BufNewFile,BufRead ~/.gnupg/gpg.conf setf gpg
|
554
|
+
au BufNewFile,BufRead /usr/**/gnupg/options.skel setf gpg
|
555
|
+
|
556
|
+
" Gnuplot scripts
|
557
|
+
au BufNewFile,BufRead *.gpi setf gnuplot
|
558
|
+
|
559
|
+
" GrADS scripts
|
560
|
+
au BufNewFile,BufRead *.gs setf grads
|
561
|
+
|
562
|
+
" Groovy
|
563
|
+
au BufNewFile,BufRead *.groovy setf groovy
|
564
|
+
|
565
|
+
" GNU Server Pages
|
566
|
+
au BufNewFile,BufRead *.gsp setf gsp
|
567
|
+
|
568
|
+
" GTK RC
|
569
|
+
au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc
|
570
|
+
|
571
|
+
" Haskell
|
572
|
+
au BufNewFile,BufRead *.hs setf haskell
|
573
|
+
au BufNewFile,BufRead *.lhs setf lhaskell
|
574
|
+
au BufNewFile,BufRead *.chs setf chaskell
|
575
|
+
|
576
|
+
" Hercules
|
577
|
+
au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules
|
578
|
+
|
579
|
+
" HEX (Intel)
|
580
|
+
au BufNewFile,BufRead *.hex,*.h32 setf hex
|
581
|
+
|
582
|
+
" Tilde (must be before HTML)
|
583
|
+
au BufNewFile,BufRead *.t.html setf tilde
|
584
|
+
|
585
|
+
" HTML (.shtml and .stm for server side)
|
586
|
+
au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call <SID>FTCheck_html()
|
587
|
+
|
588
|
+
" Distinguish between HTML and XHTML
|
589
|
+
fun! <SID>FTCheck_html()
|
590
|
+
let n = 1
|
591
|
+
while n < 10 && n < line("$")
|
592
|
+
if getline(n) =~ '\<DTD\s\+XHTML\s'
|
593
|
+
setf xhtml
|
594
|
+
return
|
595
|
+
endif
|
596
|
+
let n = n + 1
|
597
|
+
endwhile
|
598
|
+
setf html
|
599
|
+
endfun
|
600
|
+
|
601
|
+
|
602
|
+
" HTML with M4
|
603
|
+
au BufNewFile,BufRead *.html.m4 setf htmlm4
|
604
|
+
|
605
|
+
" HTML Cheetah template
|
606
|
+
au BufNewFile,BufRead *.tmpl setf htmlcheetah
|
607
|
+
|
608
|
+
" Hyper Builder
|
609
|
+
au BufNewFile,BufRead *.hb setf hb
|
610
|
+
|
611
|
+
" Icon
|
612
|
+
au BufNewFile,BufRead *.icn setf icon
|
613
|
+
|
614
|
+
" IDL (Interface Description Language)
|
615
|
+
au BufNewFile,BufRead *.idl call <SID>FTCheck_idl()
|
616
|
+
|
617
|
+
" Distinguish between standard IDL and MS-IDL
|
618
|
+
fun! <SID>FTCheck_idl()
|
619
|
+
let n = 1
|
620
|
+
while n < 50 && n < line("$")
|
621
|
+
if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
|
622
|
+
setf msidl
|
623
|
+
return
|
624
|
+
endif
|
625
|
+
let n = n + 1
|
626
|
+
endwhile
|
627
|
+
setf idl
|
628
|
+
endfun
|
629
|
+
|
630
|
+
" Microsoft IDL (Interface Description Language) Also *.idl
|
631
|
+
" MOF = WMI (Windows Management Instrumentation) Managed Object Format
|
632
|
+
au BufNewFile,BufRead *.odl,*.mof setf msidl
|
633
|
+
|
634
|
+
" Icewm menu
|
635
|
+
au BufNewFile,BufRead ~/.icewm/menu setf icemenu
|
636
|
+
|
637
|
+
" Inform
|
638
|
+
au BufNewFile,BufRead .indent.pro setf indent
|
639
|
+
|
640
|
+
" IDL (Interactive Data Language)
|
641
|
+
au BufNewFile,BufRead *.pro setf idlang
|
642
|
+
|
643
|
+
" Inform
|
644
|
+
au BufNewFile,BufRead *.inf,*.INF setf inform
|
645
|
+
|
646
|
+
" Informix 4GL (source - canonical, include file, I4GL+M4 preproc.)
|
647
|
+
au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl
|
648
|
+
|
649
|
+
" .INI file for MSDOS
|
650
|
+
au BufNewFile,BufRead *.ini setf dosini
|
651
|
+
|
652
|
+
" SysV Inittab
|
653
|
+
au BufNewFile,BufRead inittab setf inittab
|
654
|
+
|
655
|
+
" Inno Setup
|
656
|
+
au BufNewFile,BufRead *.iss setf iss
|
657
|
+
|
658
|
+
" JAL
|
659
|
+
au BufNewFile,BufRead *.jal,*.JAL setf jal
|
660
|
+
|
661
|
+
" Jam
|
662
|
+
au BufNewFile,BufRead *.jpl,*.jpr setf jam
|
663
|
+
|
664
|
+
" Java
|
665
|
+
au BufNewFile,BufRead *.java,*.jav setf java
|
666
|
+
|
667
|
+
" JavaCC
|
668
|
+
au BufNewFile,BufRead *.jj,*.jjt setf javacc
|
669
|
+
|
670
|
+
" JavaScript
|
671
|
+
au BufNewFile,BufRead *.js,*.javascript setf javascript
|
672
|
+
|
673
|
+
" Java Server Pages
|
674
|
+
au BufNewFile,BufRead *.jsp setf jsp
|
675
|
+
|
676
|
+
" Java Properties resource file (note: doesn't catch font.properties.pl)
|
677
|
+
au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_??,*.properties_??_??_* setf jproperties
|
678
|
+
|
679
|
+
" Jess
|
680
|
+
au BufNewFile,BufRead *.clp setf jess
|
681
|
+
|
682
|
+
" Jgraph
|
683
|
+
au BufNewFile,BufRead *.jgr setf jgraph
|
684
|
+
|
685
|
+
" Kixtart
|
686
|
+
au BufNewFile,BufRead *.kix setf kix
|
687
|
+
|
688
|
+
" Kimwitu[++]
|
689
|
+
au BufNewFile,BufRead *.k setf kwt
|
690
|
+
|
691
|
+
" KDE script
|
692
|
+
au BufNewFile,BufRead *.ks setf kscript
|
693
|
+
|
694
|
+
" Lace (ISE)
|
695
|
+
au BufNewFile,BufRead *.ace,*.ACE setf lace
|
696
|
+
|
697
|
+
" Latte
|
698
|
+
au BufNewFile,BufRead *.latte,*.lte setf latte
|
699
|
+
|
700
|
+
" LambdaProlog (*.mod too, see Modsim)
|
701
|
+
au BufNewFile,BufRead *.sig setf lprolog
|
702
|
+
|
703
|
+
" LDAP LDIF
|
704
|
+
au BufNewFile,BufRead *.ldif setf ldif
|
705
|
+
|
706
|
+
" Lex
|
707
|
+
au BufNewFile,BufRead *.lex,*.l setf lex
|
708
|
+
|
709
|
+
" Libao
|
710
|
+
au BufNewFile,BufRead /etc/libao.conf,~/.libao setf libao
|
711
|
+
|
712
|
+
" LFTP
|
713
|
+
au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp
|
714
|
+
|
715
|
+
" Lifelines (or Lex for C++!)
|
716
|
+
au BufNewFile,BufRead *.ll setf lifelines
|
717
|
+
|
718
|
+
" Lilo: Linux loader
|
719
|
+
au BufNewFile,BufRead lilo.conf* setf lilo
|
720
|
+
|
721
|
+
" Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp)
|
722
|
+
if has("fname_case")
|
723
|
+
au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs,.sawfishrc setf lisp
|
724
|
+
else
|
725
|
+
au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs,.sawfishrc setf lisp
|
726
|
+
endif
|
727
|
+
|
728
|
+
" Lite
|
729
|
+
au BufNewFile,BufRead *.lite,*.lt setf lite
|
730
|
+
|
731
|
+
" Logtalk
|
732
|
+
au BufNewFile,BufRead *.lgt setf logtalk
|
733
|
+
|
734
|
+
" LOTOS
|
735
|
+
au BufNewFile,BufRead *.lot,*.lotos setf lotos
|
736
|
+
|
737
|
+
" Lout (also: *.lt)
|
738
|
+
au BufNewFile,BufRead *.lou,*.lout setf lout
|
739
|
+
|
740
|
+
" Lua
|
741
|
+
au BufNewFile,BufRead *.lua setf lua
|
742
|
+
|
743
|
+
" Lynx style file (or LotusScript!)
|
744
|
+
au BufNewFile,BufRead *.lss setf lss
|
745
|
+
|
746
|
+
" M4
|
747
|
+
au BufNewFile,BufRead *.m4
|
748
|
+
\ if expand("<afile>") !~? 'html.m4$\|fvwm2rc' | setf m4 | endif
|
749
|
+
|
750
|
+
" MaGic Point
|
751
|
+
au BufNewFile,BufRead *.mgp setf mgp
|
752
|
+
|
753
|
+
" Mail (for Elm, trn, mutt, rn, slrn)
|
754
|
+
au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt-*-\w\+,mutt\w\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail
|
755
|
+
|
756
|
+
" Mailcap configuration file
|
757
|
+
au BufNewFile,BufRead .mailcap,mailcap setf mailcap
|
758
|
+
|
759
|
+
" Makefile
|
760
|
+
au BufNewFile,BufRead *[mM]akefile,*.mk,*.mak,*.dsp setf make
|
761
|
+
|
762
|
+
" MakeIndex
|
763
|
+
au BufNewFile,BufRead *.ist,*.mst setf ist
|
764
|
+
|
765
|
+
" Manpage
|
766
|
+
au BufNewFile,BufRead *.man setf man
|
767
|
+
|
768
|
+
" Maple V
|
769
|
+
au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple
|
770
|
+
|
771
|
+
" Mason
|
772
|
+
au BufNewFile,BufRead *.mason,*.mhtml setf mason
|
773
|
+
|
774
|
+
" Matlab or Objective C
|
775
|
+
au BufNewFile,BufRead *.m call FTCheck_m()
|
776
|
+
|
777
|
+
fun! FTCheck_m()
|
778
|
+
let n = 1
|
779
|
+
while n < 10
|
780
|
+
let line = getline(n)
|
781
|
+
if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
|
782
|
+
setf objc
|
783
|
+
return
|
784
|
+
endif
|
785
|
+
if line =~ '^\s*%'
|
786
|
+
setf matlab
|
787
|
+
return
|
788
|
+
endif
|
789
|
+
if line =~ '^\s*(\*'
|
790
|
+
setf mma
|
791
|
+
return
|
792
|
+
endif
|
793
|
+
let n = n + 1
|
794
|
+
endwhile
|
795
|
+
setf matlab
|
796
|
+
endfun
|
797
|
+
|
798
|
+
" Maya Extension Language
|
799
|
+
au BufNewFile,BufRead *.mel setf mel
|
800
|
+
|
801
|
+
" Metafont
|
802
|
+
au BufNewFile,BufRead *.mf setf mf
|
803
|
+
|
804
|
+
" MetaPost
|
805
|
+
au BufNewFile,BufRead *.mp setf mp
|
806
|
+
|
807
|
+
" MMIX or VMS makefile
|
808
|
+
au BufNewFile,BufRead *.mms call FTCheck_mms()
|
809
|
+
|
810
|
+
fun! FTCheck_mms()
|
811
|
+
let n = 1
|
812
|
+
while n < 10
|
813
|
+
let line = getline(n)
|
814
|
+
if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
|
815
|
+
setf mmix
|
816
|
+
return
|
817
|
+
endif
|
818
|
+
if line =~ '^\s*#'
|
819
|
+
setf make
|
820
|
+
return
|
821
|
+
endif
|
822
|
+
let n = n + 1
|
823
|
+
endwhile
|
824
|
+
setf mmix
|
825
|
+
endfun
|
826
|
+
|
827
|
+
|
828
|
+
" Modsim III (or LambdaProlog)
|
829
|
+
au BufNewFile,BufRead *.mod
|
830
|
+
\ if getline(1) =~ '\<module\>' |
|
831
|
+
\ setf lprolog |
|
832
|
+
\ else |
|
833
|
+
\ setf modsim3 |
|
834
|
+
\ endif
|
835
|
+
|
836
|
+
" Modula 2
|
837
|
+
au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2
|
838
|
+
|
839
|
+
" Modula 3 (.m3, .i3, .mg, .ig)
|
840
|
+
au BufNewFile,BufRead *.[mi][3g] setf modula3
|
841
|
+
|
842
|
+
" Monk
|
843
|
+
au BufNewFile,BufRead *.isc,*.monk,*.ssc,*.tsc setf monk
|
844
|
+
|
845
|
+
" MOO
|
846
|
+
au BufNewFile,BufRead *.moo setf moo
|
847
|
+
|
848
|
+
" Modconf
|
849
|
+
au BufNewFile,BufRead /etc/modules.conf,/etc/conf.modules setf modconf
|
850
|
+
au BufNewFile,BufRead /etc/modutils/*
|
851
|
+
\ if executable(expand("<afile>")) != 1 | setf modconf | endif
|
852
|
+
|
853
|
+
" Mplayer config
|
854
|
+
au BufNewFile,BufRead mplayer.conf,~/.mplayer/config setf mplayerconf
|
855
|
+
|
856
|
+
" Moterola S record
|
857
|
+
au BufNewFile,BufRead *.s19,*.s28,*.s37 setf srec
|
858
|
+
|
859
|
+
" Msql
|
860
|
+
au BufNewFile,BufRead *.msql setf msql
|
861
|
+
|
862
|
+
" Mysql
|
863
|
+
au BufNewFile,BufRead *.mysql setf mysql
|
864
|
+
|
865
|
+
" M$ Resource files
|
866
|
+
au BufNewFile,BufRead *.rc setf rc
|
867
|
+
|
868
|
+
" Mush
|
869
|
+
au BufNewFile,BufRead *.mush setf mush
|
870
|
+
|
871
|
+
" Mutt setup file
|
872
|
+
au BufNewFile,BufRead .muttrc*,~/.mutt/muttrc*,Muttrc setf muttrc
|
873
|
+
|
874
|
+
" Nastran input/DMAP
|
875
|
+
"au BufNewFile,BufRead *.dat setf nastran
|
876
|
+
|
877
|
+
" Natural
|
878
|
+
au BufNewFile,BufRead *.NS[ACGLMNPS] setf natural
|
879
|
+
|
880
|
+
" Novell netware batch files
|
881
|
+
au BufNewFile,BufRead *.ncf setf ncf
|
882
|
+
|
883
|
+
" Nroff/Troff (*.ms and *.t are checked below)
|
884
|
+
au BufNewFile,BufRead *.me
|
885
|
+
\ if expand("<afile>") != "read.me" && expand("<afile>") != "click.me" |
|
886
|
+
\ setf nroff |
|
887
|
+
\ endif
|
888
|
+
au BufNewFile,BufRead *.tr,*.nr,*.roff,*.tmac,*.mom setf nroff
|
889
|
+
au BufNewFile,BufRead *.[1-9] call <SID>FTnroff()
|
890
|
+
|
891
|
+
" This function checks if one of the first five lines start with a dot. In
|
892
|
+
" that case it is probably an nroff file: 'filetype' is set and 1 is returned.
|
893
|
+
fun! <SID>FTnroff()
|
894
|
+
if getline(1)[0] . getline(2)[0] . getline(3)[0] . getline(4)[0] . getline(5)[0] =~ '\.'
|
895
|
+
setf nroff
|
896
|
+
return 1
|
897
|
+
endif
|
898
|
+
return 0
|
899
|
+
endfun
|
900
|
+
|
901
|
+
" Nroff or Objective C++
|
902
|
+
au BufNewFile,BufRead *.mm call <SID>FTcheck_mm()
|
903
|
+
|
904
|
+
fun! <SID>FTcheck_mm()
|
905
|
+
let n = 1
|
906
|
+
while n < 10
|
907
|
+
let line = getline(n)
|
908
|
+
if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
|
909
|
+
setf objcpp
|
910
|
+
return
|
911
|
+
endif
|
912
|
+
let n = n + 1
|
913
|
+
endwhile
|
914
|
+
setf nroff
|
915
|
+
endfun
|
916
|
+
|
917
|
+
" Not Quite C
|
918
|
+
au BufNewFile,BufRead *.nqc setf nqc
|
919
|
+
|
920
|
+
" NSIS
|
921
|
+
au BufNewFile,BufRead *.nsi setf nsis
|
922
|
+
|
923
|
+
" OCAML
|
924
|
+
au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly setf ocaml
|
925
|
+
|
926
|
+
" Occam
|
927
|
+
au BufNewFile,BufRead *.occ setf occam
|
928
|
+
|
929
|
+
" Omnimark
|
930
|
+
au BufNewFile,BufRead *.xom,*.xin setf omnimark
|
931
|
+
|
932
|
+
" OpenROAD
|
933
|
+
au BufNewFile,BufRead *.or setf openroad
|
934
|
+
|
935
|
+
" OPL
|
936
|
+
au BufNewFile,BufRead *.[Oo][Pp][Ll] setf opl
|
937
|
+
|
938
|
+
" Oracle config file
|
939
|
+
au BufNewFile,BufRead *.ora setf ora
|
940
|
+
|
941
|
+
" Packet filter conf
|
942
|
+
au BufNewFile,BufRead pf.conf setf pf
|
943
|
+
|
944
|
+
" PApp
|
945
|
+
au BufNewFile,BufRead *.papp,*.pxml,*.pxsl setf papp
|
946
|
+
|
947
|
+
" Pascal (also *.p)
|
948
|
+
au BufNewFile,BufRead *.pas setf pascal
|
949
|
+
|
950
|
+
" Delphi project file
|
951
|
+
au BufNewFile,BufRead *.dpr setf pascal
|
952
|
+
|
953
|
+
" Perl
|
954
|
+
if has("fname_case")
|
955
|
+
au BufNewFile,BufRead *.pl,*.PL call FTCheck_pl()
|
956
|
+
else
|
957
|
+
au BufNewFile,BufRead *.pl call FTCheck_pl()
|
958
|
+
endif
|
959
|
+
|
960
|
+
fun! FTCheck_pl()
|
961
|
+
if exists("g:filetype_pl")
|
962
|
+
exe "setf " . g:filetype_pl
|
963
|
+
else
|
964
|
+
" recognize Prolog by specific text in the first non-empty line
|
965
|
+
" require a blank after the '%' because Perl uses "%list" and "%translate"
|
966
|
+
let l = getline(nextnonblank(1))
|
967
|
+
if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
|
968
|
+
setf prolog
|
969
|
+
else
|
970
|
+
setf perl
|
971
|
+
endif
|
972
|
+
endif
|
973
|
+
endfun
|
974
|
+
|
975
|
+
" Perl, XPM or XPM2
|
976
|
+
au BufNewFile,BufRead *.pm
|
977
|
+
\ if getline(1) =~ "XPM2" |
|
978
|
+
\ setf xpm2 |
|
979
|
+
\ elseif getline(1) =~ "XPM" |
|
980
|
+
\ setf xpm |
|
981
|
+
\ else |
|
982
|
+
\ setf perl |
|
983
|
+
\ endif
|
984
|
+
|
985
|
+
" Perl POD
|
986
|
+
au BufNewFile,BufRead *.pod setf pod
|
987
|
+
|
988
|
+
" Php3
|
989
|
+
au BufNewFile,BufRead *.php,*.php3 setf php
|
990
|
+
|
991
|
+
" Phtml
|
992
|
+
au BufNewFile,BufRead *.phtml setf phtml
|
993
|
+
|
994
|
+
" Pike
|
995
|
+
au BufNewFile,BufRead *.pike,*.lpc,*.ulpc,*.pmod setf pike
|
996
|
+
|
997
|
+
" Pinfo config
|
998
|
+
au BufNewFile,BufRead */etc/pinforc,~/.pinforc setf pinfo
|
999
|
+
|
1000
|
+
" Palm Resource compiler
|
1001
|
+
au BufNewFile,BufRead *.rcp setf pilrc
|
1002
|
+
|
1003
|
+
" Pine config
|
1004
|
+
au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine
|
1005
|
+
|
1006
|
+
" PL/M (also: *.inp)
|
1007
|
+
au BufNewFile,BufRead *.plm,*.p36,*.pac setf plm
|
1008
|
+
|
1009
|
+
" PL/SQL
|
1010
|
+
au BufNewFile,BufRead *.pls,*.plsql setf plsql
|
1011
|
+
|
1012
|
+
" PLP
|
1013
|
+
au BufNewFile,BufRead *.plp setf plp
|
1014
|
+
|
1015
|
+
" PO and PO template (GNU gettext)
|
1016
|
+
au BufNewFile,BufRead *.po,*.pot setf po
|
1017
|
+
|
1018
|
+
" Postfix main config
|
1019
|
+
au BufNewFile,BufRead main.cf setf pfmain
|
1020
|
+
|
1021
|
+
" PostScript (+ font files, encapsulated PostScript, Adobe Illustrator)
|
1022
|
+
au BufNewFile,BufRead *.ps,*.pfa,*.afm,*.eps,*.epsf,*.epsi,*.ai setf postscr
|
1023
|
+
|
1024
|
+
" PostScript Printer Description
|
1025
|
+
au BufNewFile,BufRead *.ppd setf ppd
|
1026
|
+
|
1027
|
+
" Povray
|
1028
|
+
au BufNewFile,BufRead *.pov setf pov
|
1029
|
+
|
1030
|
+
" Povray configuration
|
1031
|
+
au BufNewFile,BufRead .povrayrc setf povini
|
1032
|
+
|
1033
|
+
" Povray, PHP or assembly
|
1034
|
+
au BufNewFile,BufRead *.inc call FTCheck_inc()
|
1035
|
+
|
1036
|
+
fun! FTCheck_inc()
|
1037
|
+
if exists("g:filetype_inc")
|
1038
|
+
exe "setf " . g:filetype_inc
|
1039
|
+
else
|
1040
|
+
let lines = getline(1).getline(2).getline(3)
|
1041
|
+
if lines =~? "perlscript"
|
1042
|
+
setf aspperl
|
1043
|
+
elseif lines =~ "<%"
|
1044
|
+
setf aspvbs
|
1045
|
+
elseif lines =~ "<?"
|
1046
|
+
setf php
|
1047
|
+
else
|
1048
|
+
call FTCheck_asmsyntax()
|
1049
|
+
if exists("b:asmsyntax")
|
1050
|
+
exe "setf " . b:asmsyntax
|
1051
|
+
else
|
1052
|
+
setf pov
|
1053
|
+
endif
|
1054
|
+
endif
|
1055
|
+
endif
|
1056
|
+
endfun
|
1057
|
+
|
1058
|
+
" Printcap and Termcap
|
1059
|
+
au BufNewFile,BufRead *printcap
|
1060
|
+
\ let b:ptcap_type = "print" | setf ptcap
|
1061
|
+
au BufNewFile,BufRead *termcap
|
1062
|
+
\ let b:ptcap_type = "term" | setf ptcap
|
1063
|
+
|
1064
|
+
" PCCTS / ANTRL
|
1065
|
+
"au BufNewFile,BufRead *.g setf antrl
|
1066
|
+
au BufNewFile,BufRead *.g setf pccts
|
1067
|
+
|
1068
|
+
" PPWizard
|
1069
|
+
au BufNewFile,BufRead *.it,*.ih setf ppwiz
|
1070
|
+
|
1071
|
+
" Oracle Pro*C/C++
|
1072
|
+
au BufNewFile,BufRead .pc setf proc
|
1073
|
+
|
1074
|
+
" Procmail
|
1075
|
+
au BufNewFile,BufRead .procmail,.procmailrc setf procmail
|
1076
|
+
|
1077
|
+
" Progress or CWEB
|
1078
|
+
au BufNewFile,BufRead *.w call <SID>FTprogress_cweb()
|
1079
|
+
|
1080
|
+
function! <SID>FTprogress_cweb()
|
1081
|
+
if exists("g:filetype_w")
|
1082
|
+
exe "setf " . g:filetype_w
|
1083
|
+
return
|
1084
|
+
endif
|
1085
|
+
if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE'
|
1086
|
+
setf progress
|
1087
|
+
else
|
1088
|
+
setf cweb
|
1089
|
+
endif
|
1090
|
+
endfun
|
1091
|
+
|
1092
|
+
" Progress or assembly
|
1093
|
+
au BufNewFile,BufRead *.i call <SID>FTprogress_asm()
|
1094
|
+
|
1095
|
+
function! <SID>FTprogress_asm()
|
1096
|
+
if exists("g:filetype_i")
|
1097
|
+
exe "setf " . g:filetype_i
|
1098
|
+
return
|
1099
|
+
endif
|
1100
|
+
" This function checks for an assembly comment the first ten lines.
|
1101
|
+
" If not found, assume Progress.
|
1102
|
+
let lnum = 1
|
1103
|
+
while lnum <= 10
|
1104
|
+
let line = getline(lnum)
|
1105
|
+
if line =~ '^\s*;' || line =~ '^\*'
|
1106
|
+
call FTCheck_asm()
|
1107
|
+
return
|
1108
|
+
elseif line !~ '^\s*$' || line =~ '^/\*'
|
1109
|
+
" Not an empty line: Doesn't look like valid assembly code.
|
1110
|
+
" Or it looks like a Progress /* comment
|
1111
|
+
break
|
1112
|
+
endif
|
1113
|
+
let lnum = lnum + 1
|
1114
|
+
endw
|
1115
|
+
setf progress
|
1116
|
+
endfun
|
1117
|
+
|
1118
|
+
" Progress or Pascal
|
1119
|
+
au BufNewFile,BufRead *.p call <SID>FTprogress_pascal()
|
1120
|
+
|
1121
|
+
function! <SID>FTprogress_pascal()
|
1122
|
+
if exists("g:filetype_p")
|
1123
|
+
exe "setf " . g:filetype_p
|
1124
|
+
return
|
1125
|
+
endif
|
1126
|
+
" This function checks for valid Pascal syntax in the first ten lines.
|
1127
|
+
" Look for either an opening comment or a program start.
|
1128
|
+
" If not found, assume Progress.
|
1129
|
+
let lnum = 1
|
1130
|
+
while lnum <= 10
|
1131
|
+
let line = getline(lnum)
|
1132
|
+
if line =~ '^\s*\(program\|procedure\|function\|const\|type\|var\)\>'
|
1133
|
+
\ || line =~ '^\s*{' || line =~ '^\s*(\*'
|
1134
|
+
setf pascal
|
1135
|
+
return
|
1136
|
+
elseif line !~ '^\s*$' || line =~ '^/\*'
|
1137
|
+
" Not an empty line: Doesn't look like valid Pascal code.
|
1138
|
+
" Or it looks like a Progress /* comment
|
1139
|
+
break
|
1140
|
+
endif
|
1141
|
+
let lnum = lnum + 1
|
1142
|
+
endw
|
1143
|
+
setf progress
|
1144
|
+
endfun
|
1145
|
+
|
1146
|
+
|
1147
|
+
" Software Distributor Product Specification File (POSIX 1387.2-1995)
|
1148
|
+
au BufNewFile,BufRead *.psf setf psf
|
1149
|
+
au BufNewFile,BufRead INDEX,INFO
|
1150
|
+
\ if getline(1) =~ '^\s*\(distribution\|installed_software\|root\|bundle\|product\)\s*$' |
|
1151
|
+
\ setf psf |
|
1152
|
+
\ endif
|
1153
|
+
|
1154
|
+
" Prolog
|
1155
|
+
au BufNewFile,BufRead *.pdb setf prolog
|
1156
|
+
|
1157
|
+
" Pyrex
|
1158
|
+
au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
|
1159
|
+
|
1160
|
+
" Python
|
1161
|
+
au BufNewFile,BufRead *.py,*.pyw setf python
|
1162
|
+
|
1163
|
+
" Radiance
|
1164
|
+
au BufNewFile,BufRead *.rad,*.mat setf radiance
|
1165
|
+
|
1166
|
+
" Ratpoison config/command files
|
1167
|
+
au BufNewFile,BufRead .ratpoisonrc,ratpoisonrc setf ratpoison
|
1168
|
+
|
1169
|
+
" RCS file
|
1170
|
+
au BufNewFile,BufRead *\,v setf rcs
|
1171
|
+
|
1172
|
+
" Readline
|
1173
|
+
au BufNewFile,BufRead .inputrc setf readline
|
1174
|
+
|
1175
|
+
" Registry for MS-Windows
|
1176
|
+
au BufNewFile,BufRead *.reg
|
1177
|
+
\ if getline(1) =~? '^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$' | setf registry | endif
|
1178
|
+
|
1179
|
+
" Renderman Interface Bytestream
|
1180
|
+
au BufNewFile,BufRead *.rib setf rib
|
1181
|
+
|
1182
|
+
" Rexx
|
1183
|
+
au BufNewFile,BufRead *.rexx,*.rex setf rexx
|
1184
|
+
|
1185
|
+
" R (Splus)
|
1186
|
+
au BufNewFile,BufRead *.s,*.S setf r
|
1187
|
+
|
1188
|
+
" Rexx, Rebol or R
|
1189
|
+
au BufNewFile,BufRead *.r,*.R call <SID>FTCheck_r()
|
1190
|
+
|
1191
|
+
fun! <SID>FTCheck_r()
|
1192
|
+
if getline(1) =~ '^REBOL'
|
1193
|
+
setf rebol
|
1194
|
+
else
|
1195
|
+
let n = 1
|
1196
|
+
let max = line("$")
|
1197
|
+
if max > 50
|
1198
|
+
let max = 50
|
1199
|
+
endif
|
1200
|
+
while n < max
|
1201
|
+
" R has # comments
|
1202
|
+
if getline(n) =~ '^\s*#'
|
1203
|
+
setf r
|
1204
|
+
break
|
1205
|
+
endif
|
1206
|
+
" Rexx has /* comments */
|
1207
|
+
if getline(n) =~ '^\s*/\*'
|
1208
|
+
setf rexx
|
1209
|
+
break
|
1210
|
+
endif
|
1211
|
+
let n = n + 1
|
1212
|
+
endwhile
|
1213
|
+
if n >= max
|
1214
|
+
setf rexx
|
1215
|
+
endif
|
1216
|
+
endif
|
1217
|
+
endfun
|
1218
|
+
|
1219
|
+
" Remind
|
1220
|
+
au BufNewFile,BufRead .reminders* setf remind
|
1221
|
+
|
1222
|
+
" Resolv.conf
|
1223
|
+
au BufNewFile,BufRead resolv.conf setf resolv
|
1224
|
+
|
1225
|
+
" Relax NG Compact
|
1226
|
+
au BufNewFile,BufRead *.rnc setf rnc
|
1227
|
+
|
1228
|
+
" RPL/2
|
1229
|
+
au BufNewFile,BufRead *.rpl setf rpl
|
1230
|
+
|
1231
|
+
" Robots.txt
|
1232
|
+
au BufNewFile,BufRead robots.txt setf robots
|
1233
|
+
|
1234
|
+
" Rpcgen
|
1235
|
+
au BufNewFile,BufRead *.x setf rpcgen
|
1236
|
+
|
1237
|
+
" reStructuredText Documentation Format
|
1238
|
+
au BufNewFile,BufRead *.rst setf rst
|
1239
|
+
|
1240
|
+
" RTF
|
1241
|
+
au BufNewFile,BufRead *.rtf setf rtf
|
1242
|
+
|
1243
|
+
" Ruby
|
1244
|
+
au BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec setf ruby
|
1245
|
+
|
1246
|
+
" ERuby
|
1247
|
+
au BufNewFile,BufRead *.rhtml setf eruby
|
1248
|
+
|
1249
|
+
" S-lang (or shader language!)
|
1250
|
+
au BufNewFile,BufRead *.sl setf slang
|
1251
|
+
|
1252
|
+
" Samba config
|
1253
|
+
au BufNewFile,BufRead smb.conf setf samba
|
1254
|
+
|
1255
|
+
" SAS script
|
1256
|
+
au BufNewFile,BufRead *.sas setf sas
|
1257
|
+
|
1258
|
+
" Sather
|
1259
|
+
au BufNewFile,BufRead *.sa setf sather
|
1260
|
+
|
1261
|
+
" Scilab
|
1262
|
+
au BufNewFile,BufRead *.sci setf scilab
|
1263
|
+
|
1264
|
+
" SDL
|
1265
|
+
au BufNewFile,BufRead *.sdl,*.pr setf sdl
|
1266
|
+
|
1267
|
+
" sed
|
1268
|
+
au BufNewFile,BufRead *.sed setf sed
|
1269
|
+
|
1270
|
+
" Sendmail
|
1271
|
+
au BufNewFile,BufRead sendmail.cf setf sm
|
1272
|
+
|
1273
|
+
" Sendmail .mc files are actually m4
|
1274
|
+
au BufNewFile,BufRead *.mc setf m4
|
1275
|
+
|
1276
|
+
" SGML
|
1277
|
+
au BufNewFile,BufRead *.sgm,*.sgml
|
1278
|
+
\ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'linuxdoc' |
|
1279
|
+
\ setf sgmllnx |
|
1280
|
+
\ elseif getline(1) =~ '<!DOCTYPE.*DocBook' || getline(2) =~ '<!DOCTYPE.*DocBook' |
|
1281
|
+
\ let b:docbk_type="sgml" |
|
1282
|
+
\ setf docbk |
|
1283
|
+
\ else |
|
1284
|
+
\ setf sgml |
|
1285
|
+
\ endif
|
1286
|
+
|
1287
|
+
" SGMLDECL
|
1288
|
+
au BufNewFile,BufRead *.decl,*.dcl,*.dec
|
1289
|
+
\ if getline(1).getline(2).getline(3) =~? '^<!SGML' |
|
1290
|
+
\ setf sgmldecl |
|
1291
|
+
\ endif
|
1292
|
+
|
1293
|
+
" SGML catalog file
|
1294
|
+
au BufNewFile,BufRead sgml.catalog*,catalog setf catalog
|
1295
|
+
|
1296
|
+
" Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc.
|
1297
|
+
" Gentoo ebuilds are actually bash scripts
|
1298
|
+
au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash")
|
1299
|
+
au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh")
|
1300
|
+
au BufNewFile,BufRead /etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1))
|
1301
|
+
|
1302
|
+
fun! SetFileTypeSH(name)
|
1303
|
+
if a:name =~ '\<ksh\>'
|
1304
|
+
let b:is_kornshell = 1
|
1305
|
+
if exists("b:is_bash")
|
1306
|
+
unlet b:is_bash
|
1307
|
+
endif
|
1308
|
+
if exists("b:is_sh")
|
1309
|
+
unlet b:is_sh
|
1310
|
+
endif
|
1311
|
+
elseif exists("g:bash_is_sh") || a:name =~ '\<bash\>' || a:name =~ '\<bash2\>'
|
1312
|
+
let b:is_bash = 1
|
1313
|
+
if exists("b:is_kornshell")
|
1314
|
+
unlet b:is_kornshell
|
1315
|
+
endif
|
1316
|
+
if exists("b:is_sh")
|
1317
|
+
unlet b:is_sh
|
1318
|
+
endif
|
1319
|
+
elseif a:name =~ '\<sh\>'
|
1320
|
+
let b:is_sh = 1
|
1321
|
+
if exists("b:is_kornshell")
|
1322
|
+
unlet b:is_kornshell
|
1323
|
+
endif
|
1324
|
+
if exists("b:is_bash")
|
1325
|
+
unlet b:is_bash
|
1326
|
+
endif
|
1327
|
+
endif
|
1328
|
+
setf sh
|
1329
|
+
endfun
|
1330
|
+
|
1331
|
+
" tcsh scripts
|
1332
|
+
au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login setf tcsh
|
1333
|
+
|
1334
|
+
" csh scripts, but might also be tcsh scripts (on some systems csh is tcsh)
|
1335
|
+
au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call SetFileTypeCSH()
|
1336
|
+
|
1337
|
+
fun! SetFileTypeCSH()
|
1338
|
+
if exists("g:filetype_csh")
|
1339
|
+
exe "setf " . g:filetype_csh
|
1340
|
+
elseif &shell =~ "tcsh"
|
1341
|
+
setf tcsh
|
1342
|
+
else
|
1343
|
+
setf csh
|
1344
|
+
endif
|
1345
|
+
endfun
|
1346
|
+
|
1347
|
+
" Z-Shell script
|
1348
|
+
au BufNewFile,BufRead .zsh*,.zlog*,.zprofile,/etc/zprofile,.zfbfmarks,.zcompdump* setf zsh
|
1349
|
+
|
1350
|
+
" Scheme
|
1351
|
+
au BufNewFile,BufRead *.scm,*.ss setf scheme
|
1352
|
+
|
1353
|
+
" Screen RC
|
1354
|
+
au BufNewFile,BufRead .screenrc,screenrc setf screen
|
1355
|
+
|
1356
|
+
" Simula
|
1357
|
+
au BufNewFile,BufRead *.sim setf simula
|
1358
|
+
|
1359
|
+
" SINDA
|
1360
|
+
au BufNewFile,BufRead *.sin,*.s85 setf sinda
|
1361
|
+
|
1362
|
+
" SKILL
|
1363
|
+
au BufNewFile,BufRead *.il setf skill
|
1364
|
+
|
1365
|
+
" SLRN
|
1366
|
+
au BufNewFile,BufRead .slrnrc setf slrnrc
|
1367
|
+
au BufNewFile,BufRead *.score setf slrnsc
|
1368
|
+
|
1369
|
+
" Smalltalk
|
1370
|
+
au BufNewFile,BufRead *.st,*.cls setf st
|
1371
|
+
|
1372
|
+
" Smarty templates
|
1373
|
+
au BufNewFile,BufRead *.tpl setf smarty
|
1374
|
+
|
1375
|
+
" SMIL or XML
|
1376
|
+
au BufNewFile,BufRead *.smil
|
1377
|
+
\ if getline(1) =~ '<?\s*xml.*?>' |
|
1378
|
+
\ setf xml |
|
1379
|
+
\ else |
|
1380
|
+
\ setf smil |
|
1381
|
+
\ endif
|
1382
|
+
|
1383
|
+
" SMIL or SNMP MIB file
|
1384
|
+
au BufNewFile,BufRead *.smi
|
1385
|
+
\ if getline(1) =~ '\<smil\>' |
|
1386
|
+
\ setf smil |
|
1387
|
+
\ else |
|
1388
|
+
\ setf mib |
|
1389
|
+
\ endif
|
1390
|
+
|
1391
|
+
" SMITH
|
1392
|
+
au BufNewFile,BufRead *.smt,*.smith setf smith
|
1393
|
+
|
1394
|
+
" Snobol4
|
1395
|
+
au BufNewFile,BufRead *.sno setf snobol4
|
1396
|
+
|
1397
|
+
" SNMP MIB files
|
1398
|
+
au BufNewFile,BufRead *.mib,*.my setf mib
|
1399
|
+
|
1400
|
+
" Snort Configuration
|
1401
|
+
au BufNewFile,BufRead *.hog,snort.conf,vision.conf,*.rules setf hog
|
1402
|
+
|
1403
|
+
" Spec (Linux RPM)
|
1404
|
+
au BufNewFile,BufRead *.spec setf spec
|
1405
|
+
|
1406
|
+
" Speedup (AspenTech plant simulator)
|
1407
|
+
au BufNewFile,BufRead *.speedup,*.spdata,*.spd setf spup
|
1408
|
+
|
1409
|
+
" Slice
|
1410
|
+
au BufNewFile,BufRead *.ice setf slice
|
1411
|
+
|
1412
|
+
" Spice
|
1413
|
+
au BufNewFile,BufRead *.sp,*.spice setf spice
|
1414
|
+
|
1415
|
+
" Spyce
|
1416
|
+
au BufNewFile,BufRead *.spy,*.spi setf spyce
|
1417
|
+
|
1418
|
+
" Squid
|
1419
|
+
au BufNewFile,BufRead squid.conf setf squid
|
1420
|
+
|
1421
|
+
" SQL (all but the first one for Oracle Designer)
|
1422
|
+
au BufNewFile,BufRead *.sql,*.tyb,*.typ,*.tyc,*.pkb,*.pks setf sql
|
1423
|
+
|
1424
|
+
" SQLJ
|
1425
|
+
au BufNewFile,BufRead *.sqlj setf sqlj
|
1426
|
+
|
1427
|
+
" SQR
|
1428
|
+
au BufNewFile,BufRead *.sqr,*.sqi setf sqr
|
1429
|
+
|
1430
|
+
" OpenSSH configuration
|
1431
|
+
au BufNewFile,BufRead ssh_config,.ssh/config setf sshconfig
|
1432
|
+
|
1433
|
+
" OpenSSH server configuration
|
1434
|
+
au BufNewFile,BufRead sshd_config setf sshdconfig
|
1435
|
+
|
1436
|
+
" Stored Procedures
|
1437
|
+
au BufNewFile,BufRead *.stp setf stp
|
1438
|
+
|
1439
|
+
" Standard ML
|
1440
|
+
au BufNewFile,BufRead *.sml setf sml
|
1441
|
+
|
1442
|
+
" Tads (or Nroff)
|
1443
|
+
au BufNewFile,BufRead *.t
|
1444
|
+
\ if !<SID>FTnroff() | setf tads | endif
|
1445
|
+
|
1446
|
+
" Tags
|
1447
|
+
au BufNewFile,BufRead tags setf tags
|
1448
|
+
|
1449
|
+
" TAK
|
1450
|
+
au BufNewFile,BufRead *.tak setf tak
|
1451
|
+
|
1452
|
+
" Tcl
|
1453
|
+
au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk setf tcl
|
1454
|
+
|
1455
|
+
" TealInfo
|
1456
|
+
au BufNewFile,BufRead *.tli setf tli
|
1457
|
+
|
1458
|
+
" Telix Salt
|
1459
|
+
au BufNewFile,BufRead *.slt setf tsalt
|
1460
|
+
|
1461
|
+
" Terminfo
|
1462
|
+
au BufNewFile,BufRead *.ti setf terminfo
|
1463
|
+
|
1464
|
+
" TeX
|
1465
|
+
au BufNewFile,BufRead *.tex,*.latex,*.sty,*.dtx,*.ltx,*.bbl setf tex
|
1466
|
+
|
1467
|
+
" Texinfo
|
1468
|
+
au BufNewFile,BufRead *.texinfo,*.texi,*.txi setf texinfo
|
1469
|
+
|
1470
|
+
" TeX configuration
|
1471
|
+
au BufNewFile,BufRead texmf.cnf setf texmf
|
1472
|
+
|
1473
|
+
" Tidy config
|
1474
|
+
au BufNewFile,BufRead .tidyrc,tidyrc setf tidy
|
1475
|
+
|
1476
|
+
" TF mud client
|
1477
|
+
au BufNewFile,BufRead *.tf,.tfrc,tfrc setf tf
|
1478
|
+
|
1479
|
+
" TSS - Geometry
|
1480
|
+
au BufNewFile,BufReadPost *.tssgm setf tssgm
|
1481
|
+
|
1482
|
+
" TSS - Optics
|
1483
|
+
au BufNewFile,BufReadPost *.tssop setf tssop
|
1484
|
+
|
1485
|
+
" TSS - Command Line (temporary)
|
1486
|
+
au BufNewFile,BufReadPost *.tsscl setf tsscl
|
1487
|
+
|
1488
|
+
" Motif UIT/UIL files
|
1489
|
+
au BufNewFile,BufRead *.uit,*.uil setf uil
|
1490
|
+
|
1491
|
+
" UnrealScript
|
1492
|
+
au BufNewFile,BufRead *.uc setf uc
|
1493
|
+
|
1494
|
+
" Verilog HDL
|
1495
|
+
au BufNewFile,BufRead *.v setf verilog
|
1496
|
+
|
1497
|
+
" VHDL
|
1498
|
+
au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vhdl_[0-9]*,*.vbe,*.vst setf vhdl
|
1499
|
+
|
1500
|
+
" Vim script
|
1501
|
+
au BufNewFile,BufRead *.vim,.exrc,_exrc setf vim
|
1502
|
+
|
1503
|
+
" Viminfo file
|
1504
|
+
au BufNewFile,BufRead .viminfo,_viminfo setf viminfo
|
1505
|
+
|
1506
|
+
" Virata Config Script File
|
1507
|
+
au BufRead,BufNewFile *.hw,*.module,*.pkg setf virata
|
1508
|
+
|
1509
|
+
" Visual Basic (also uses *.bas) or FORM
|
1510
|
+
au BufNewFile,BufRead *.frm call <SID>FTVB("form")
|
1511
|
+
|
1512
|
+
" SaxBasic is close to Visual Basic
|
1513
|
+
au BufNewFile,BufRead *.sba setf vb
|
1514
|
+
|
1515
|
+
" Vgrindefs file
|
1516
|
+
au BufNewFile,BufRead vgrindefs setf vgrindefs
|
1517
|
+
|
1518
|
+
" VRML V1.0c
|
1519
|
+
au BufNewFile,BufRead *.wrl setf vrml
|
1520
|
+
|
1521
|
+
" Webmacro
|
1522
|
+
au BufNewFile,BufRead *.wm setf webmacro
|
1523
|
+
|
1524
|
+
" Wget config
|
1525
|
+
au BufNewFile,BufRead .wgetrc,wgetrc setf wget
|
1526
|
+
|
1527
|
+
" Website MetaLanguage
|
1528
|
+
au BufNewFile,BufRead *.wml setf wml
|
1529
|
+
|
1530
|
+
" Winbatch
|
1531
|
+
au BufNewFile,BufRead *.wbt setf winbatch
|
1532
|
+
|
1533
|
+
" WvDial
|
1534
|
+
au BufNewFile,BufRead wvdial.conf,.wvdialrc setf wvdial
|
1535
|
+
|
1536
|
+
" CVS RC file
|
1537
|
+
au BufNewFile,BufRead .cvsrc setf cvsrc
|
1538
|
+
|
1539
|
+
" CVS commit file
|
1540
|
+
au BufNewFile,BufRead cvs\d\+ setf cvs
|
1541
|
+
|
1542
|
+
" WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment
|
1543
|
+
" lines in a WEB file).
|
1544
|
+
au BufNewFile,BufRead *.web
|
1545
|
+
\ if getline(1)[0].getline(2)[0].getline(3)[0].getline(4)[0].getline(5)[0] =~ "%" |
|
1546
|
+
\ setf web |
|
1547
|
+
\ else |
|
1548
|
+
\ setf winbatch |
|
1549
|
+
\ endif
|
1550
|
+
|
1551
|
+
" Windows Scripting Host and Windows Script Component
|
1552
|
+
au BufNewFile,BufRead *.ws[fc] setf wsh
|
1553
|
+
|
1554
|
+
" X Pixmap (dynamically sets colors, use BufEnter to make it work better)
|
1555
|
+
au BufEnter *.xpm
|
1556
|
+
\ if getline(1) =~ "XPM2" |
|
1557
|
+
\ setf xpm2 |
|
1558
|
+
\ else |
|
1559
|
+
\ setf xpm |
|
1560
|
+
\ endif
|
1561
|
+
au BufEnter *.xpm2 setf xpm2
|
1562
|
+
|
1563
|
+
" XFree86 config
|
1564
|
+
au BufNewFile,BufRead XF86Config
|
1565
|
+
\ if getline(1) =~ '\<XConfigurator\>' |
|
1566
|
+
\ let b:xf86c_xfree86_version = 3 |
|
1567
|
+
\ endif |
|
1568
|
+
\ setf xf86conf
|
1569
|
+
|
1570
|
+
" Xorg config
|
1571
|
+
au BufNewFile,BufRead xorg.conf,xorg.conf-4 let b:xf86c_xfree86_version = 4 | setf xf86conf
|
1572
|
+
|
1573
|
+
" XS Perl extension interface language
|
1574
|
+
au BufNewFile,BufRead *.xs setf xs
|
1575
|
+
|
1576
|
+
" X resources file
|
1577
|
+
au BufNewFile,BufRead .Xdefaults,.Xpdefaults,.Xresources,xdm-config,*.ad setf xdefaults
|
1578
|
+
|
1579
|
+
" Xmath
|
1580
|
+
au BufNewFile,BufRead *.msc,*.msf setf xmath
|
1581
|
+
au BufNewFile,BufRead *.ms
|
1582
|
+
\ if !<SID>FTnroff() | setf xmath | endif
|
1583
|
+
|
1584
|
+
" XML
|
1585
|
+
au BufNewFile,BufRead *.xml
|
1586
|
+
\ if getline(1) . getline(2) . getline(3) =~ '<!DOCTYPE.*DocBook' |
|
1587
|
+
\ let b:docbk_type="xml" |
|
1588
|
+
\ setf docbk |
|
1589
|
+
\ else |
|
1590
|
+
\ setf xml |
|
1591
|
+
\ endif
|
1592
|
+
|
1593
|
+
" XMI (holding UML models) is also XML
|
1594
|
+
au BufNewFile,BufRead *.xmi setf xml
|
1595
|
+
|
1596
|
+
" CSPROJ files are Visual Studio.NET's XML-based project config files
|
1597
|
+
au BufNewFile,BufRead *.csproj,*.csproj.user setf xml
|
1598
|
+
|
1599
|
+
" Qt Linguist translation source and Qt User Interface Files are XML
|
1600
|
+
au BufNewFile,BufRead *.ts,*.ui setf xml
|
1601
|
+
|
1602
|
+
" XSD
|
1603
|
+
au BufNewFile,BufRead *.xsd setf xsd
|
1604
|
+
|
1605
|
+
" Xslt
|
1606
|
+
au BufNewFile,BufRead *.xsl,*.xslt setf xslt
|
1607
|
+
|
1608
|
+
" Yacc
|
1609
|
+
au BufNewFile,BufRead *.y,*.yy setf yacc
|
1610
|
+
|
1611
|
+
" Yaml
|
1612
|
+
au BufNewFile,BufRead *.yaml,*.yml setf yaml
|
1613
|
+
|
1614
|
+
" Z80 assembler asz80
|
1615
|
+
au BufNewFile,BufRead *.z8a setf z8a
|
1616
|
+
|
1617
|
+
augroup END
|
1618
|
+
|
1619
|
+
|
1620
|
+
" Source the user-specified filetype file, for backwards compatibility with
|
1621
|
+
" Vim 5.x.
|
1622
|
+
if exists("myfiletypefile") && file_readable(expand(myfiletypefile))
|
1623
|
+
execute "source " . myfiletypefile
|
1624
|
+
endif
|
1625
|
+
|
1626
|
+
|
1627
|
+
" Check for "*" after loading myfiletypefile, so that scripts.vim is only used
|
1628
|
+
" when there are no matching file name extensions.
|
1629
|
+
" Don't do this for compressed files.
|
1630
|
+
augroup filetypedetect
|
1631
|
+
au BufNewFile,BufRead *
|
1632
|
+
\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
|
1633
|
+
\ | runtime! scripts.vim | endif
|
1634
|
+
au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif
|
1635
|
+
|
1636
|
+
|
1637
|
+
" Extra checks for when no filetype has been detected now. Mostly used for
|
1638
|
+
" patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim
|
1639
|
+
" script file.
|
1640
|
+
|
1641
|
+
" BIND zone
|
1642
|
+
au BufNewFile,BufRead /var/named/* setf bindzone
|
1643
|
+
|
1644
|
+
" Changelog
|
1645
|
+
au BufNewFile,BufRead [cC]hange[lL]og* if getline(1) =~ '; urgency='
|
1646
|
+
\| setf debchangelog | else | setf changelog | endif
|
1647
|
+
|
1648
|
+
" Crontab
|
1649
|
+
au BufNewFile,BufRead crontab,crontab.* setf crontab
|
1650
|
+
|
1651
|
+
" Dracula
|
1652
|
+
au BufNewFile,BufRead drac.* setf dracula
|
1653
|
+
|
1654
|
+
" Fvwm
|
1655
|
+
au BufNewFile,BufRead *fvwmrc*,*fvwm95*.hook
|
1656
|
+
\ let b:fvwm_version = 1 | setf fvwm
|
1657
|
+
au BufNewFile,BufRead *fvwm2rc*
|
1658
|
+
\ if expand("<afile>:e") == "m4" | setf fvwm2m4 | else |
|
1659
|
+
\ let b:fvwm_version = 2 | setf fvwm | endif
|
1660
|
+
|
1661
|
+
" GTK RC
|
1662
|
+
au BufNewFile,BufRead .gtkrc*,gtkrc* setf gtkrc
|
1663
|
+
|
1664
|
+
" Jam
|
1665
|
+
au BufNewFile,BufRead Prl*.*,JAM*.* setf jam
|
1666
|
+
|
1667
|
+
" Jargon
|
1668
|
+
au! BufNewFile,BufRead *jarg*
|
1669
|
+
\ if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'THIS IS THE JARGON FILE' |
|
1670
|
+
\ setf jargon |
|
1671
|
+
\ endif
|
1672
|
+
|
1673
|
+
" Makefile
|
1674
|
+
au BufNewFile,BufRead [mM]akefile* setf make
|
1675
|
+
|
1676
|
+
" Ruby Makefile
|
1677
|
+
au BufNewFile,BufRead [rR]akefile* setf ruby
|
1678
|
+
|
1679
|
+
" Mutt setup file
|
1680
|
+
au BufNewFile,BufRead muttrc*,Muttrc* setf muttrc
|
1681
|
+
|
1682
|
+
" Nroff macros
|
1683
|
+
au BufNewFile,BufRead tmac.* setf nroff
|
1684
|
+
|
1685
|
+
" Printcap and Termcap
|
1686
|
+
au BufNewFile,BufRead *printcap*
|
1687
|
+
\ if !did_filetype() | let b:ptcap_type = "print" | setf ptcap | endif
|
1688
|
+
au BufNewFile,BufRead *termcap*
|
1689
|
+
\ if !did_filetype() | let b:ptcap_type = "term" | setf ptcap | endif
|
1690
|
+
|
1691
|
+
" Vim script
|
1692
|
+
au BufNewFile,BufRead *vimrc* setf vim
|
1693
|
+
|
1694
|
+
" Subversion commit file
|
1695
|
+
au BufNewFile,BufRead svn-commit.*.tmp setf svn
|
1696
|
+
au BufNewFile,BufRead svn-commit.tmp setf svn
|
1697
|
+
|
1698
|
+
" X resources file
|
1699
|
+
au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* setf xdefaults
|
1700
|
+
|
1701
|
+
" XFree86 config
|
1702
|
+
au BufNewFile,BufRead XF86Config-4*
|
1703
|
+
\ let b:xf86c_xfree86_version = 4 | setf xf86conf
|
1704
|
+
au BufNewFile,BufRead XF86Config*
|
1705
|
+
\ if getline(1) =~ '\<XConfigurator\>' |
|
1706
|
+
\ let b:xf86c_xfree86_version = 3 |
|
1707
|
+
\ endif |
|
1708
|
+
\ setf xf86conf
|
1709
|
+
|
1710
|
+
" X11 xmodmap
|
1711
|
+
au BufNewFile,BufRead *xmodmap* setf xmodmap
|
1712
|
+
|
1713
|
+
" Z-Shell script
|
1714
|
+
au BufNewFile,BufRead zsh*,zlog* setf zsh
|
1715
|
+
|
1716
|
+
|
1717
|
+
" Generic configuration file (check this last, it's just guessing!)
|
1718
|
+
au BufNewFile,BufRead,StdinReadPost *
|
1719
|
+
\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
|
1720
|
+
\ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
|
1721
|
+
\ || getline(4) =~ '^#' || getline(5) =~ '^#') |
|
1722
|
+
\ setf conf |
|
1723
|
+
\ endif
|
1724
|
+
|
1725
|
+
" Use the plugin-filetype checks last, they may overrule any of the previously
|
1726
|
+
" detected filetypes.
|
1727
|
+
runtime! ftdetect/*.vim
|
1728
|
+
|
1729
|
+
augroup END
|
1730
|
+
|
1731
|
+
|
1732
|
+
" If the GUI is already running, may still need to install the Syntax menu.
|
1733
|
+
" Don't do it when the 'M' flag is included in 'guioptions'.
|
1734
|
+
if has("menu") && has("gui_running")
|
1735
|
+
\ && !exists("did_install_syntax_menu") && &guioptions !~# "M"
|
1736
|
+
source <sfile>:p:h/menu.vim
|
1737
|
+
endif
|
1738
|
+
|
1739
|
+
" Restore 'cpoptions'
|
1740
|
+
let &cpo = s:cpo_save
|
1741
|
+
unlet s:cpo_save
|