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

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

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

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

> *.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.

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. -!-

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
-" 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
 " Smarty templates
 au BufNewFile,BufRead *.tpl			setf smarty


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

Version: GnuPG v1.4.0 (GNU/Linux)