http://qs1969.pair.com?node_id=246221


in reply to Re: Using vim for highlighting in Perl
in thread Using vim for highlighting in Perl

The default perl syntax highlighting does break on some things, but it does allow the regex delimiters (!/# etc) you mention (vim 6.1.422, $VIMRUNTIME/syntax/perl.vim 30 Dec 2002). qq!! does not highlight correctly, but qq##, qq() etc do.

I have emailed the maintainer a patch to handle the ! delimiter in q, qq, qw, qr expressions.

You can download the latest syntax files from ftp://ftp.vim.org, or http://www.van-laarhoven.org/vim/syntax/perl.vim for the perl syntax specifically.

Replies are listed 'Best First'.
Re: Re: Re: Using vim for highlighting in Perl
by tachyon (Chancellor) on Mar 27, 2003 at 23:08 UTC

    Thanks for that. I have a slightly earlier version of 6.1. Would you be able to post your patch here perhaps? I ma sure I am not the only one who does qq!<var="blah">! and the like so it would have general appeal.

    Speaking of patches have you also patched the pod implementation by chance. This chunk of pod looks rather odd in vim. It is one =head1 and one =cut but confuses vim no end.

      The patch is on my scratchpad, assuming you have diff/patch. Unfortunately, the maintainer of the syntax file says that adding the patch slows down vim on his 160MHz machine, so he's not going to add it - which I find a little strange to be honest. He suggests using the the pipe character | instead. To my mind, the ! is more common, but TMTOWTDI I suppose. Anyway, the patch doesn't seem to slow vim down at all on my machine (700MHz, Win2K).

      Your pod seems to be fine in both set ft=perl and set ft=pod, provided I make it say =cut at the end and not =cu. That's with the latest perl.vim from the link I gave earlier, dated 23 Mar 2003. What filetype are you using (:set ft?)?

        The =cu was a cut and paste typo. I have been just letting it default (>>seems<< to be using perl syntax on .pl files as normal code is now fine(ish)) The pod above highlights with all sorts of highlights - like a very broken syntax highlight. I will grab the patch off you pad. Thanks very much. I have the latest syntax files now from the maintainer which still wierd out on this pod. It is usually several 1000 lines down at the end of the code.

        I guess I will just have to fix it myself.

        A PI 166? Even my linux devel box is a PII 266. My last PI just died of natural causes. I generally get to run vim on server class boxes which usually have multiple PIII Xeons > 1GHz and lots of RAM so speed is rarely an issue.

        cheers

        tachyon

        s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print