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

weird matchadd() behavior

Expand Messages
  • Kartik Agaram
    Dear vim devs, ... Is there a reason for this? I ve tested it without any startup files on 7.3 (patches 1-1302) on linux, with a file containing the following:
    Message 1 of 3 , Jan 30, 2014
    • 0 Attachment
      Dear vim devs,

      I just noticed that this colorizes:

      :call matchadd('Identifier', '\<@abc\>')

      But this doesn't:

      :call matchadd('Identifier', '\<@abc\>')

      Is there a reason for this? I've tested it without any startup files on 7.3 (patches 1-1302) on linux, with a file containing the following:

      abc
      abcd
      @abc

      Thanks in advance,
      Kartik
      http://akkartik.name

      --
      --
      You received this message from the "vim_dev" 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
       
      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Kartik Agaram
      Argh, apologies, that didn t come out right. Let me try again. If I have these lines on screen: abc ... This causes the bolded bits to be colorized, as
      Message 2 of 3 , Jan 30, 2014
      • 0 Attachment
        Argh, apologies, that didn't come out right. Let me try again.

        If I have these lines on screen:

        abc
        abcd
        @abc

        ..and I type:

        :call matchadd('Identifier', '\<abc\>')

        This causes the bolded bits to be colorized, as expected:

        abc
        abcd
        @abc

        However, if I instead type:

        :call matchadd('Identifier', '\<@abc\>')

        then nothing is colorized. That seems surprising. I expected to see the same behavior as if I'd typed:

        :call matchadd('Identifier', '@abc')

        In this case the third line colorizes. Are others able to reproduce this?

        I'd like to colorize specific patterns with more than a single word that are surrounded by word boundaries, but can't figure out how to do so.

        --
        --
        You received this message from the "vim_dev" 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
         
        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • John Little
        The pattern
        Message 3 of 3 , Jan 30, 2014
        • 0 Attachment
          The pattern \<@ does not make sense with the default setting of the iskeyword option, \< matches the beginning of a word, but @ is not a word character, so it shouldn't match anything. If I

          set isk+=@-@

          then the last line is matched. Maybe the use of @ in iskeyword has mislead you; it doesn't mean "@", you need @-@ to match a "@".

          Regards, John Little

          --
          --
          You received this message from the "vim_dev" 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

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.