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

34603Re: "syn match" proposal

Expand Messages
  • Ilya Sher
    Feb 3, 2004
    • 0 Attachment
      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

      -----END PGP SIGNATURE-----
    • Show all 5 messages in this topic