scripts.vim patch

jamessan@jamessan.com jamessan@jamessan.com
Fri, 20 May 2005 12:02:48 -0400


--HG+GLK89HZ1zG0kk
Content-Type: multipart/mixed; boundary="vGgW1X5XWziG23Ko"
Content-Disposition: inline


--vGgW1X5XWziG23Ko
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline

Bram,

I'm a member of the maintainer group for Debian's Vim package.  Attached
is a patch for runtime/scripts.vim to address the bug reported in
<http://bugs.debian.org/309859>.

This patch includes support for detecting #! lines for Lua scripts.
I've also added support for scripts which use

#!/usr/bin/env program [path/args]

instead of

#!/usr/bin/program [path/args]

James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@jamessan.com>

--vGgW1X5XWziG23Ko
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename="scripts.vim.diff"
Content-Transfer-Encoding: quoted-printable

diff -ur vim63.orig/runtime/scripts.vim vim63/runtime/scripts.vim
--- vim63.orig/runtime/scripts.vim	2004-04-18 06:54:30.000000000 -0400
+++ vim63/runtime/scripts.vim	2005-05-20 10:04:08.000000000 -0400
@@ -40,10 +40,14 @@
=20
   " 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 =3D~ '^#!\s*\a:[/\\]'
     let s:name =3D substitute(s:line1, '^#!.*[/\\]\(\i\+\).*', '\1', '')
+  elseif s:line1 =3D~ '^#!.*\<env\>'
+    let s:name =3D substitute(s:line1, '^#!.*\<env\>\s\+\(\i\+\).*', '\1',=
 '')
   elseif s:line1 =3D~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)'
     let s:name =3D substitute(s:line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '')
   else
@@ -86,6 +90,10 @@
   elseif s:name =3D~ 'make\>'
     set ft=3Dmake
=20
+    " Lua
+  elseif s:name =3D~ 'lua'
+    set ft=3Dlua
+
     " Perl
   elseif s:name =3D~ 'perl'
     set ft=3Dperl

--vGgW1X5XWziG23Ko--

--HG+GLK89HZ1zG0kk
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iEYEARECAAYFAkKOCigACgkQDb3UpmEybUCaRACeLh23jpkW2qh2gFBD1EQWfYx2
WMAAmwSU9+3lJbKVkK+QO5rzZEJhOkaN
=5Qq1
-----END PGP SIGNATURE-----

--HG+GLK89HZ1zG0kk--