filetype.vim
Pierre Habouzit
pierre.habouzit@m4x.org
Wed, 16 Mar 2005 17:36:06 +0100
--nextPart5322000.lpZprx2BQj
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Le Mercredi 16 Mars 2005 17:36, Bram Moolenaar a =E9crit=A0:
> Pierre -
>
> > > OK, that problem I can see. Strange, why would the rule work one
> > > time and not the other time. I'll look into it. I don't want to
> > > add ".gz", I want to fix the real problem.
> >
> > Agreed.
> >
> > So let me informed when you have a real solution ;)
>
> The good solution is a bit complicated.
>
> What happens is that the pattern [cC]hange[lL]og* matches
> changelog.Debian.gz. It then checks the first line for "urgency =3D",
> but since the file is still compressed it doesn't match and sets the
> filetype to "changelog". After decompressing the file the filetype
> is already set and won't be changed.
>
> To avoid this I made all filetype checks with a pattern ending in a
> "*" compare the filename against g:ft_ignore_pat. I do this in a
> function, called from many places. This is too complicated to
> include in the stable 6.3 version. I have changed it for Vim 7.
>
> If you want a temporary fix, use something like this (untested):
>
> " Changelog
> au BufNewFile,BufRead [cC]hange[lL]og*
> \ if expand("<amatch>") !~ g:ft_ignore_pat
> \ if getline(1) =3D~ '; urgency=3D'
> \| call s:StarSetf('debchangelog')
> \| else
> \| call s:StarSetf('changelog')
> \| endif
> \|endif
>
> - Bram
thank you very much.
I'll have a look at it then
=2D-=20
=B7O=B7 Pierre Habouzit
=B7=B7O
OOO http://www.madism.org
--nextPart5322000.lpZprx2BQj
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Signed by Pierre Habouzit <pierre.habouzit@m4x.org>
iD8DBQBCOGB4vGr7W6HudhwRAtJSAJ9PiNRa/H5Q9pwyb1IlRB/FgW/P8QCfYTaI
x2yatSSmCHeP0c3dEwzcS5g=
=PTgX
-----END PGP SIGNATURE-----
--nextPart5322000.lpZprx2BQj--