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

weird vim.vim syn highlighting

Expand Messages
  • Johannes Zellner
    Hello,weird: view the attached file with vim.-- Johannesthe ^a stands for `any command a a : a :: a : : a
    Message 1 of 2 , Jul 6, 2000
    • 0 Attachment
      Hello,

      weird: view the attached file with vim.

      --
      Johannes
    • Dr. Charles E. Campbell
      Hello! There was a bit of a bug; only the : should have been highlighted as vimRegister, not :: . However, the fix for that (available at
      Message 2 of 2 , Nov 26, 2005
      • 0 Attachment
        Hello!

        There was a bit of a bug; only the ": should have been highlighted as
        vimRegister, not ":: . However, the fix for that (available at
        http://www.erols.com/astronaut/vim/syntax/vim.vim.gz) doesn't really
        improve the situation that JZ noticed.

        Its difficult to have the syntax properly and generally decide when one has a
        register ("a), a comment ("....), or a string ("..."). A way to do it so that
        <vim.vim> syntax highlighting which perhaps has the potential of being correct
        more often is to go through all the individual commands and write syntax
        handling for each one, separately. That would result in an enormous
        slower-than-a-snail syntax-highlighting file. Shucks, <vim.vim> is already
        big.

        There are more difficulties, however; consider the substitute command.
        The text indicates that

        :[range]s[ubstitute]/{pattern}/{string}/[c][e][g][p][r][i][I] [count]
        ..etc..

        but actually the "/"s may be most if not all punctuation characters. So
        consider

        :s!"this!is a sub"!

        You can even apply this particular sub to itself.

        Needless to say, <vim.vim> as it currently stands doesn't highlight that
        properly. I suspect that the vim language isn't a LALR grammar due to this
        sort of thing (ie. its not context-free). The new 6.0 coming out should allow
        one to pass start patterns to ending patterns, so this particular construct'
        associated syntax highlighting may have a fix in the near future (I believe
        Bram said about two weeks!). I'll have to see about the (unexpected)
        interactions, though.

        In the problematic cases in JZ's example below, most of them depend on the fact
        that ": is a (read-only) register. There are several special registers that are
        accessed via punctuation: "[-:.%#=*_/] (see :he registers). <vim.vim> is having
        a problem deciding when to highlight as a vimRegister vs as a vimString.

        Regards,
        Dr C

        ---------------------------------------------------------------------
        Thus saith Johannes Zellner: wierd!
        " the ^a stands for `any command'
        a "\<c-d>"
        a ":\<c-d>"
        a "::\<c-d>"
        a ": :\<c-d>"
        a "::::\<c-d>"
        a ":::aa:\<c-d>"
        a ":::au:\<c-d>"
        a "a\<c-d>"
        a "aa\<c-d>"
        a ":aa\<c-d>"
        a ": a\<c-d>"
        ---------------------------------------------------------------------

        --
        Charles E Campbell, Jr, PhD _ __ __
        Goddard Space Flight Center / /_/\_\_/ /
        cec@... /_/ \/_//_/
        PGP public key: http://www.erols.com/astronaut/pgp.html/
      Your message has been successfully submitted and would be delivered to recipients shortly.