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

"syn match" proposal

Expand Messages
  • Ilya Sher
    ... Hash: SHA1 Hi all. INTRO: I was trying to fix highlighting of the following 2 lines (my .vimrc) map :syn match PreProc ^[^:] +: let
    Message 1 of 5 , Feb 2, 2004
    • 0 Attachment
      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1

      Hi all.

      INTRO:
      I was trying to fix highlighting of the following 2 lines (my .vimrc)
      map <S-F10> :syn match PreProc "^[^:]\+:"<CR>
      let html_use_css=1

      THE PROBLEM:
      1) [in vim.vim syntax file]
      syn cluster vimSynMtchGroup contains=...,vimSynRegPat
      ...
      syn region vimSynMatchRegion ... contains=@vimSynMtchGroup

      That means that "match blah-blah" may have more than
      one pattern. For example:
      (*) syn match "a" contains=x "b"
      (as to my case : "<CR>" and on is matched as if it's next pattern)
      Since i was trying to fix according to vim's behaviour i found :

      2) [vim, sources, somewhere]
      Vim excepts the line (*), uses the first pattern and silently
      discards the second (and on?) pattern.

      PROPOSAL:
      1) Give an error when several patterns to "match" given
      2) Fix the syntax file according to #1 when(if) it's agreed and fixed

      P.S.
      I'm not good at C and I am not familiar with vim's sources.
      That means that I can try #2 but not #1.

      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.2.2 (GNU/Linux)
      Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

      iD8DBQFAH1THKQCqGJKGZm4RAua1AKDQ8iu/hyRTuwtQG//3pXkoEBAiVACfbRxs
      n4yGGW010sBdE3oQnhOguZg=
      =GDRa
      -----END PGP SIGNATURE-----
    • Bram Moolenaar
      ... Don t put syntax command in your .vimrc. Clearing syntax will make them ineffective. Using a file in ~/.vim/syntax is probably what you need. ... I don t
      Message 2 of 5 , Feb 3, 2004
      • 0 Attachment
        Ilya Sher wrote:

        > INTRO:
        > I was trying to fix highlighting of the following 2 lines (my .vimrc)
        > map <S-F10> :syn match PreProc "^[^:]\+:"<CR>
        > let html_use_css=1

        Don't put syntax command in your .vimrc. Clearing syntax will make them
        ineffective. Using a file in ~/.vim/syntax is probably what you need.

        > THE PROBLEM:
        > 1) [in vim.vim syntax file]
        > syn cluster vimSynMtchGroup contains=...,vimSynRegPat
        > ...
        > syn region vimSynMatchRegion ... contains=@vimSynMtchGroup
        >
        > That means that "match blah-blah" may have more than
        > one pattern. For example:
        > (*) syn match "a" contains=x "b"
        > (as to my case : "<CR>" and on is matched as if it's next pattern)

        I don't understand this...

        > Since i was trying to fix according to vim's behaviour i found :
        >
        > 2) [vim, sources, somewhere]
        > Vim excepts the line (*), uses the first pattern and silently
        > discards the second (and on?) pattern.

        That's because a " starts a comment. Thus the second pattern, and
        everything after it, is ignored. You might be confused by the Vim
        syntax highlighting, it's not as clever as Vim itself for comments.

        --
        How To Keep A Healthy Level Of Insanity:
        13. Go to a poetry recital and ask why the poems don't rhyme.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
      • Ilya Sher
        ... Hash: SHA1 ... Thanks for the advice. It s a very small hack to view grep xyz * | vim - so i m not that worried about clearing of syntax. ... map
        Message 3 of 5 , Feb 3, 2004
        • 0 Attachment
          -----BEGIN PGP SIGNED MESSAGE-----
          Hash: SHA1

          Bram Moolenaar wrote:

          | Ilya Sher wrote:
          |
          |> INTRO: I was trying to fix highlighting of the following 2 lines
          |> (my .vimrc) map <S-F10> :syn match PreProc "^[^:]\+:"<CR> let
          |> html_use_css=1
          |
          |
          | Don't put syntax command in your .vimrc. Clearing syntax will make
          | them ineffective. Using a file in ~/.vim/syntax is probably what
          | you need.

          Thanks for the advice.
          It's a very small hack to view
          grep xyz * | vim -
          so i'm not that worried about clearing of syntax.

          |
          |> THE PROBLEM: 1) [in vim.vim syntax file] syn cluster
          |> vimSynMtchGroup contains=...,vimSynRegPat ... syn region
          |> vimSynMatchRegion ... contains=@vimSynMtchGroup
          |>
          |> That means that "match blah-blah" may have more than one pattern.
          |> For example: (*) syn match "a" contains=x "b" (as to my case :
          |> "<CR>" and on is matched as if it's next pattern)
          |
          |
          | I don't understand this...


          map <S-F10> :syn match PreProc "^[^:]\+:"<CR>
          vimSynRegPat #1: ^^^^^^^^^^
          vimSynRegPat #2: ^^^^

          vimSynRegPat #2 never ends looking for the enclosing "<"
          that should match end="\z1"
          ( for start="\z([[:punct:]]\)" that matched "<")

          |
          |> Since i was trying to fix according to vim's behaviour i found :
          |>
          |> 2) [vim, sources, somewhere] Vim excepts the line (*), uses the
          |> first pattern and silently discards the second (and on?) pattern.
          |>
          |
          |
          | That's because a " starts a comment. Thus the second pattern, and
          | everything after it, is ignored. You might be confused by the Vim
          | syntax highlighting, it's not as clever as Vim itself for comments.
          |
          OK. I see now.
          I think i should give it a try to correct vim.vim now that you
          explained me what's going on ;)
          Any ideas how this should be done in a straight way ?
          I suppose vimSynRegPat should be excluded from
          syn cluster vimSynMtchGroup
          so it won't match several times but what than .... ?


          -----BEGIN PGP SIGNATURE-----
          Version: GnuPG v1.2.2 (GNU/Linux)
          Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

          iD8DBQFAH4BeKQCqGJKGZm4RAqG9AKCL+x2lJqr6gab7syTw4iLxvZOGaACffd6x
          OHYMCAd4aZ5HP9yRmV2V22k=
          =v/KT
          -----END PGP SIGNATURE-----
        • Bram Moolenaar
          ... It took me a while before I realized you are talking about highlighting this line in a Vim script. I first thought you were talking about the command
          Message 4 of 5 , Feb 3, 2004
          • 0 Attachment
            Ilya Sher wrote:

            > |> THE PROBLEM: 1) [in vim.vim syntax file] syn cluster
            > |> vimSynMtchGroup contains=...,vimSynRegPat ... syn region
            > |> vimSynMatchRegion ... contains=@vimSynMtchGroup
            > |>
            > |> That means that "match blah-blah" may have more than one pattern.
            > |> For example: (*) syn match "a" contains=x "b" (as to my case :
            > |> "<CR>" and on is matched as if it's next pattern)
            > |
            > |
            > | I don't understand this...
            >
            >
            > map <S-F10> :syn match PreProc "^[^:]\+:"<CR>
            > vimSynRegPat #1: ^^^^^^^^^^
            > vimSynRegPat #2: ^^^^
            >
            > vimSynRegPat #2 never ends looking for the enclosing "<"
            > that should match end="\z1"
            > ( for start="\z([[:punct:]]\)" that matched "<")

            It took me a while before I realized you are talking about highlighting
            this line in a Vim script. I first thought you were talking about the
            command itself.

            Please communicate with Charles Campbell about improving the Vim script
            highlighting. It's quite complicated, he knows all about it.

            --
            I am also told that there is a logical proof out there somewhere
            that demonstrates that there is no task which duct tape cannot handle.
            -- Paul Brannan

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
            \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
          • Ilya Sher
            ... Hash: SHA1 ... Yep. thanks, my .vimrc is fixed now: map :syn match PreProc ^[^:] +: is not vimSynRegPat anymore it s vimNotation as it
            Message 5 of 5 , Feb 12, 2004
            • 0 Attachment
              -----BEGIN PGP SIGNED MESSAGE-----
              Hash: SHA1

              Charles E. Campbell, Jr. wrote:

              | Ilya Sher wrote:
              |
              |> The file says Version: 6.2-12 What I had before was Version:
              |> 6.2-11
              |
              |
              |
              | Hello!
              |
              | I've uploaded v 6.2-14 which appears to address the problem.

              Yep. thanks, my .vimrc is fixed now:
              map <S-F10> :syn match PreProc "^[^:]\+:"<CR>
              <CR> is not vimSynRegPat anymore it's
              vimNotation as it should be

              | [snip]

              | Hope it helps, Chip Campbell
              |
              |
              |
              |
              |

              -----BEGIN PGP SIGNATURE-----
              Version: GnuPG v1.2.2 (GNU/Linux)
              Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

              iD8DBQFAK9csKQCqGJKGZm4RAvojAJ9MhfXQ4nCR82IOZR6lRjNXCRbq9wCgsN6R
              BR/XA1HdYinR4dlJ9hzWpck=
              =qFvQ
              -----END PGP SIGNATURE-----
            Your message has been successfully submitted and would be delivered to recipients shortly.