Bug#169716: vim: *.cls to filetype mapping needs extension

Stefano Zacchiroli Stefano Zacchiroli <zack@debian.org>, 169716@bugs.debian.org
Sun, 8 May 2005 17:10:46 +0200


--E39vaYmALEf/7YXx
Content-Type: multipart/mixed; boundary="OXfL5xGRrasGEqWY"
Content-Disposition: inline


--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

tags 169716 + pending patch
forwarded 169716 Bram@moolenaar.net
thanks

> *.cls are recognized as smalltalk files by vim. They are also LaTeX
> class files. In most cases, LaTeX class files start with the first
> line =3D~ '^%%', so maybe the following in $VIMRUNTIME/scripts.vim will
> work:
>
>   elseif s:line1 =3D~ '^%%'
>     set ft=3Dtex

Attached you will find the patch I applied to the debian package which
fixes this behaviour. I set ft=3Dtex if just one '%' is found since many
third part classes (e.g. LNCS, ENTCS) starts in such a way.

Of course the patch is now for /usr/share/vim/vim63/filetype.vim.

Bram, could you please consider including the attached patch to future
vim versions?

Many thanks.
Cheers.

--=20
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-

--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="126_filetype.vim.diff"
Content-Transfer-Encoding: quoted-printable

diff -urN vim63/runtime/filetype.vim vim63.new/runtime/filetype.vim
--- vim63/runtime/filetype.vim	2005-05-08 17:01:08.000000000 +0200
+++ vim63.new/runtime/filetype.vim	2005-05-08 16:57:42.000000000 +0200
@@ -1363,8 +1363,14 @@
 au BufNewFile,BufRead .slrnrc			setf slrnrc
 au BufNewFile,BufRead *.score			setf slrnsc
=20
-" Smalltalk
-au BufNewFile,BufRead *.st,*.cls		setf st
+" Smalltalk (or TeX class)
+au BufNewFile,BufRead *.st			setf st
+au BufNewFile,BufRead *.cls
+	\ if getline(1) =3D~ '^%' |
+	\   setf tex |
+	\ else |
+	\   setf st |
+	\ endif
=20
 " Smarty templates
 au BufNewFile,BufRead *.tpl			setf smarty

--OXfL5xGRrasGEqWY--

--E39vaYmALEf/7YXx
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

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

iD8DBQFCfiv21cqbBPLEI7wRAnP8AKCCzeQ8IgIdKjHN8MeMQqtv20si5gCeLCeD
1RCWXZ3Ej4GXFbNT0I8fJhc=
=vAFS
-----END PGP SIGNATURE-----

--E39vaYmALEf/7YXx--