[pacman-dev] vim syntax file for PKGBUILDs

Alessio 'mOLOk' Bolognino themolok.ml at gmail.com
Mon May 7 19:42:22 EDT 2007


On 19:04 Mon 07 May     , Dan McGee wrote:
> 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 :)

First of all, thanks for the suggestions

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

OK, I can keep it more sober. I'll change the colors to look like sh.vim
(the shell syntax-file)

> * I couldn't get the illegal md5sum/sha1sum highlighting to ever work.

Mmm... Strangely enough here it works, this is the intended behaviour:
if the hash is <32 chars, it should be marked all red (well, the color
changes according with your vimrc, but it is usually red), if the hash is
 >32chars, the chars after the 32nd should be marked red.
(A couple of people tested it and it works on their machine too)

> * Multi-line arrays without a '\' on end of lines do not highlight properly.

It's not a bug, it's a feature! :D
Seriously, I think you noticed this in the source array, it highlights
the remote files only, not the local ones.

> * There are a lot of commented out lines in the file; I think it would
> be much clearer if anything unnecessary is removed.

Well, you're right :)

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

I'll improve it in my spare time and I'll send here patches.
Cheers,

-- 
Alessio 'mOLOk' Bolognino
Arch Linux Trusted User

Public Key @ http://themolok.netsons.org/uploads/themolok.asc
Key ID = 1024D / FE0270FB 2007-04-11
Key Fingerprint = 9AF8 9011 F271 450D 59CF  2D7D 96C9 8F2A FE02 70FB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://archlinux.org/pipermail/pacman-dev/attachments/20070508/bf592566/attachment.pgp>


More information about the pacman-dev mailing list