diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-05-20 21:31:17 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-05-20 21:31:17 +0000 |
commit | f4630b60f598db3c163182f1920e7308d5b54cbb (patch) | |
tree | d188f060814b7375e95212b7076236338da22913 /runtime/scripts.vim | |
parent | c930a3cc82074f14f2674aa039ca46d961edb297 (diff) |
updated for version 7.0074v7.0074
Diffstat (limited to 'runtime/scripts.vim')
-rw-r--r-- | runtime/scripts.vim | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/scripts.vim b/runtime/scripts.vim index e25da8717d..dd439efdd8 100644 --- a/runtime/scripts.vim +++ b/runtime/scripts.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types in scripts " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2005 Mar 04 +" Last change: 2005 May 20 " This file is called by an autocommand for every file that has just been " loaded into a buffer. It checks if the type of file can be recognized by @@ -15,7 +15,7 @@ endif " Load the user defined scripts file first " Only do this when the FileType autocommand has not been triggered yet -if exists("myscriptsfile") && file_readable(expand(myscriptsfile)) +if exists("myscriptsfile") && filereadable(expand(myscriptsfile)) execute "source " . myscriptsfile if did_filetype() finish @@ -40,10 +40,14 @@ if s:line1 =~ "^#!" " Get the program name. " Only accept spaces in PC style paths: "#!c:/program files/perl [args]". + " If the word env is used, use the first word after the space: + " "#!/usr/bin/env perl [path/args]" " If there is no path use the first word: "#!perl [path/args]". " Otherwise get the last word after a slash: "#!/usr/bin/perl [path/args]". if s:line1 =~ '^#!\s*\a:[/\\]' let s:name = substitute(s:line1, '^#!.*[/\\]\(\i\+\).*', '\1', '') + elseif s:line1 =~ '^#!.*\<env\>' + let s:name = substitute(s:line1, '^#!.*\<env\>\s\+\(\i\+\).*', '\1', '') elseif s:line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)' let s:name = substitute(s:line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '') else @@ -86,6 +90,10 @@ if s:line1 =~ "^#!" elseif s:name =~ 'make\>' set ft=make + " Lua + elseif s:name =~ 'lua' + set ft=lua + " Perl elseif s:name =~ 'perl' set ft=perl |