Loading ...
Sorry, an error occurred while loading the content.

Shortcoming in perl syntax file

Expand Messages
  • Ben Fritz
    Does anyone know if there is a good reason that the distributed perl.vim syntax file only supports //, ##, {}, and [] style regex delimiters? A huge host of
    Message 1 of 2 , Aug 5, 2008
    • 0 Attachment
      Does anyone know if there is a good reason that the distributed
      perl.vim syntax file only supports //, ##, {}, and [] style regex
      delimiters? A huge host of delimiters is supported by perl itself,
      just like in Vim, such as:

      ++
      --
      ()
      ))
      @@
      ""
      ''

      And more.

      I can certainly understand if it fails to catch a few of the less-used
      ones, but why check explicitly for only 4 patterns?
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Benjamin Fritz
      ... With a little snooping, I found this: http://www.vim.org/scripts/script.php?script_id=2300 At least some of this script should probably be incorporated
      Message 2 of 2 , Aug 6, 2008
      • 0 Attachment
        On Tue, Aug 5, 2008 at 3:14 PM, Nick Hibma <nick@...> wrote:
        > Because I use those. And they are the ones most commonly used. Supporting all
        > of them bloats the syntax file.
        >
        > With Perl you will have to adapt your coding style slightly to the syntax
        > highlighting unfortunately.
        >
        > Nick

        With a little snooping, I found this:

        http://www.vim.org/scripts/script.php?script_id=2300

        At least some of this script should probably be incorporated into the
        "official" version.

        Also to consider: syntax folding does not work properly if the code
        does not use this style:

        if (foo) { # the brace is on the same line as the statement
        dostuff();
        } # the brace has the exact indentation level as the statement
        (composed of the same whitespace, even)

        I've inherited code, that I want to change as little as possible,
        written in this format:

        if (foo)
        { # opening brace indented one more level, on the next line
        dostuff();
        } # closing brace _not_ at the same level as the opening statement

        To make matters worse, the indentation is not even always consistent
        (here and there appears a real tab, while most of the file is indented
        with spaces, and every now and then they left out a space or put in an
        extra one).

        Regardless, I don't think syntax highlighting should get screwed up by
        matters of coding style (unless people do really crazy stuff, like
        write their code all on a single line -- I can certainly accept
        reasonably limits).

        I'm considering writing a patch for the folding behavior if I find the
        time, but would certainly not mind if someone else beat me to it.
        Since someone has already done arbitrary delimiter matching, I won't
        bother with that (unless I find out that it doesn't work for some
        reason).

        It looks like the _intent_ of the current folding behavior is to fold
        the entire block into the line containing "if", "while", "foreach",
        etc. Whoever makes the patch should probably try to stick to that,
        though it also means that blocks without such statements don't get
        folded at all without some fancy doings.

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_dev" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.