comparison runtime/scripts.vim @ 279:946f0cbdd535 v7.0074

updated for version 7.0074
author vimboss
date Fri, 20 May 2005 21:31:17 +0000
parents 7fd70926e2e1
children da9142bd190a
comparison
equal deleted inserted replaced
278:a7e59720a155 279:946f0cbdd535
1 " Vim support file to detect file types in scripts 1 " Vim support file to detect file types in scripts
2 " 2 "
3 " Maintainer: Bram Moolenaar <Bram@vim.org> 3 " Maintainer: Bram Moolenaar <Bram@vim.org>
4 " Last change: 2005 Mar 04 4 " Last change: 2005 May 20
5 5
6 " This file is called by an autocommand for every file that has just been 6 " This file is called by an autocommand for every file that has just been
7 " loaded into a buffer. It checks if the type of file can be recognized by 7 " loaded into a buffer. It checks if the type of file can be recognized by
8 " the file contents. The autocommand is in $VIMRUNTIME/filetype.vim. 8 " the file contents. The autocommand is in $VIMRUNTIME/filetype.vim.
9 9
13 finish 13 finish
14 endif 14 endif
15 15
16 " Load the user defined scripts file first 16 " Load the user defined scripts file first
17 " Only do this when the FileType autocommand has not been triggered yet 17 " Only do this when the FileType autocommand has not been triggered yet
18 if exists("myscriptsfile") && file_readable(expand(myscriptsfile)) 18 if exists("myscriptsfile") && filereadable(expand(myscriptsfile))
19 execute "source " . myscriptsfile 19 execute "source " . myscriptsfile
20 if did_filetype() 20 if did_filetype()
21 finish 21 finish
22 endif 22 endif
23 endif 23 endif
38 let s:line1 = substitute(s:line1, '\<env\s\+', '', '') 38 let s:line1 = substitute(s:line1, '\<env\s\+', '', '')
39 endif 39 endif
40 40
41 " Get the program name. 41 " Get the program name.
42 " Only accept spaces in PC style paths: "#!c:/program files/perl [args]". 42 " Only accept spaces in PC style paths: "#!c:/program files/perl [args]".
43 " If the word env is used, use the first word after the space:
44 " "#!/usr/bin/env perl [path/args]"
43 " If there is no path use the first word: "#!perl [path/args]". 45 " If there is no path use the first word: "#!perl [path/args]".
44 " Otherwise get the last word after a slash: "#!/usr/bin/perl [path/args]". 46 " Otherwise get the last word after a slash: "#!/usr/bin/perl [path/args]".
45 if s:line1 =~ '^#!\s*\a:[/\\]' 47 if s:line1 =~ '^#!\s*\a:[/\\]'
46 let s:name = substitute(s:line1, '^#!.*[/\\]\(\i\+\).*', '\1', '') 48 let s:name = substitute(s:line1, '^#!.*[/\\]\(\i\+\).*', '\1', '')
49 elseif s:line1 =~ '^#!.*\<env\>'
50 let s:name = substitute(s:line1, '^#!.*\<env\>\s\+\(\i\+\).*', '\1', '')
47 elseif s:line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)' 51 elseif s:line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)'
48 let s:name = substitute(s:line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '') 52 let s:name = substitute(s:line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '')
49 else 53 else
50 let s:name = substitute(s:line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '') 54 let s:name = substitute(s:line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '')
51 endif 55 endif
83 set ft=gnuplot 87 set ft=gnuplot
84 88
85 " Makefiles 89 " Makefiles
86 elseif s:name =~ 'make\>' 90 elseif s:name =~ 'make\>'
87 set ft=make 91 set ft=make
92
93 " Lua
94 elseif s:name =~ 'lua'
95 set ft=lua
88 96
89 " Perl 97 " Perl
90 elseif s:name =~ 'perl' 98 elseif s:name =~ 'perl'
91 set ft=perl 99 set ft=perl
92 100