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

117216Re: [bug?] \zs in regex not working with ":syn match ..."

Expand Messages
  • Jürgen Krämer
    Sep 3, 2010
    • 0 Attachment
      Hi,

      Dominique Pellé schrieb:
      > Given the fillowing text in a buffer:
      >
      > ABCDEF
      > GHIJKL
      >
      > The following command does not highlight anything
      > and I don't see why:
      >
      > :syn clear | syn match Error 'DEF\_.\zsGHI'
      >
      > Nothing is highlighted. I would expect GHI to be highlighted.
      >
      > Is it a bug?
      >
      > You can reproduce it with:
      >
      > $ (echo ABCDEF; echo GHIJKL) | \
      > vim -u NONE -N \
      > -c 'syntax on' \
      > -c ":syn clear | syn match Error 'DEF\_.\zsGHI'" -
      >
      > If I remove \zs (start of match) then text is highlighted as expected:
      >
      > :syn clear | syn match Error 'DEF\_.GHI'
      >
      > If I use \ze, then text is also highlighted as expected:
      >
      > :syn clear | syn match Error 'DEF\_.\zeGHI'
      >
      > But somehow it does not work when I try to use \zs.
      > I'm using Vim-7.3.3 on Linux x86.

      there is a note in :help syntax.txt at line 3567 (Vim 7.3.3):

      - The start of a match cannot be in a line other than where the pattern
      matched. This doesn't work: "a\nb"ms=e. You can make the highlighting
      start in another line, this does work: "a\nb"hs=e.

      This seems to talk about the ms-flag, but it might be relevant to your
      case, too.

      Regards,
      Jürgen

      --
      Sometimes I think the surest sign that intelligent life exists elsewhere
      in the universe is that none of it has tried to contact us. (Calvin)

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 3 messages in this topic