[pacman-dev] vim syntax file for PKGBUILDs

Dan McGee dpmcgee at gmail.com
Mon May 7 19:04:56 EDT 2007


On 5/7/07, Alessio 'mOLOk' Bolognino <themolok.ml at gmail.com> wrote:
> On 08:33 Sun 06 May     , Alessio 'mOLOk' Bolognino wrote:
> > Hi Guys,
> > I spent an insane amount of time (last night) writing this (I hope so)
> > useful thing: it's a vim syntax file for PKGBUILDs, to use it you
> > should put it in ~/.vim/syntax/ and add this line at the bottom
> > of your ~/.vimrc:
> >
> > autocmd BufReadPost PKGBUILD  set filetype=PKGBUILD
> >
> > The colors are more or less random, but it does (cool?) things like check
> > for wrong pkgname, pkgver, pkgrel, it complains if the pkgdesc is too
> > long, and other stuff.
> > This is my first syntax file (and I hope it'll be the last :)
> > I'm not a regex guru so many things could be buggy, but well, feel free
> > to improve it and add your name in the headers.
> > Cheers,
> >
> > Here is the patch:
> > [...]
>
> Well, I improved it a bit, the new patch is based on the current repo
> (not on the old patch), so, if you want to try it, apply this one only.
> Here is a little feature list:
> it marks:
> invalid pkgname (strange or >32 chars);
> pkgrel (containing hyphens or other shit);
> pkgrel (everything but digits);
> pkgdesc too long (>80 chars) and pkgdesc containing "foobar is a" that is a
> common error (800+ packages in the AUR begins with this description...);
> wrong url (without http:// and others);
> wrong licenses (everything but the common ones and custom:foobar)
> wrong arch (not i686 || x86_64 || ppc)
> non standard .install file (i.e. without the .install suffix )
> specific sourceforge mirror in the source array (very common error too)
> md5sums != 32 chars
> sha1sums != 40 chars
> wrong options (and marks "no" in nooption in yellow because it is deprecated);
> In the build() it is used the sh.vim syntax-file.
>
> I think this syntax file is very useful while checking users' packages
> and avoids some common errors.
> Enjoy it VIMmers :)

Just tried it out and I like it, and I have a few suggestions as well.
* I noticed you tried to vary the colors used for pkgname, pkgver,
conflicts, replaces, etc. This may seem bright and colorful, but I
personally don't like it at all. I would rather everything on the
right side of the equals sign be the same color (the only exception
being things in quotes or things not in quotes).
* I couldn't get the illegal md5sum/sha1sum highlighting to ever work.
* Multi-line arrays without a '\' on end of lines do not highlight properly.
* There are a lot of commented out lines in the file; I think it would
be much clearer if anything unnecessary is removed.

Although I said a lot there, it is good enough to find a place in my GIT tree.
<http://code.toofishes.net/gitweb.cgi?p=pacman.git;a=commit;h=d45f977e0657881a542586f688e675c2b010a894>

-Dan




More information about the pacman-dev mailing list