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

Re: indent/vim.vim does not work when ignorecase is 1

Expand Messages
  • Shougo
    ... Because, indent/vim.vim(and I think other plugins too) uses match(). This functions also uses ignorecase option. I can t fix it easily. So I used try
    Message 1 of 6 , Aug 2, 2012
    • 0 Attachment
      > Why don’t fix the problem by explicitely using “[=!][~=][#?]” everywhere? I just always use “#” and “?” for string comparison, no matter whether it is “=~”, “is” or their opposites (yes, and I never use “==”/“!=” for string comparison). All the problems should be fixed by running
      >

      Because, indent/vim.vim(and I think other plugins too) uses match(). This functions also uses 'ignorecase' option.
      I can't fix it easily. So I used try finally block and changed ignorecase option.

      >
      >
      > perl -p -i -e 's/(?<=[!=]~)(?![?#])/#/g unless /^\s*setlocal/' indent/*.vim
      >
      > additionally reviewing changes when processing plugins for languages which contain this operator. The result seem to be harmless: http://bpaste.net/show/38213/.

      So I think your changes is incomplete.

      Thanks your reply.

      --
      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
    • ZyX
      ... Bad. I now must go and change all match(), matchstr(), matchlist() and matchend() calls at least in all of my plugins. Thanks for pointing this out. It is
      Message 2 of 6 , Aug 2, 2012
      • 0 Attachment
        пятница, 3 августа 2012 г., 5:42:30 UTC+4 пользователь Shougo написал:
        > > Why don't fix the problem by explicitely using "[=!][~=][#?]" everywhere? I just always use "#" and "?" for string comparison, no matter whether it is "=~", "is" or their opposites (yes, and I never use "=="/"!=" for string comparison). All the problems should be fixed by running
        >
        > >
        >
        >
        >
        > Because, indent/vim.vim(and I think other plugins too) uses match(). This functions also uses 'ignorecase' option.
        >
        > I can't fix it easily. So I used try finally block and changed ignorecase option.

        Bad. I now must go and change all match(), matchstr(), matchlist() and matchend() calls at least in all of my plugins. Thanks for pointing this out.

        It is still not impossible to do with a perl (ir)regular expression, but if you do grep there you will see that there are not many such calls that need to be fixed. This patch (http://bpaste.net/show/38266/) was produced by
        perl -p -i -e 's#(match(?:str|list|end)?\((?:[^([,]+|\(([^(\[]+|\((?2)*\)|\[(?2)*\])|\[(?2)*\])+,\s*(?:\[(?:\\.|[^\]])+\]|('')(?=(?:(?:(?!\\[cC])[^''])+?|'''')*?(?<!\\)(?<!\\[_z])[a-zA-Z](?![^\[\]]*\]))|(")(?=(?:(?:(?!\\\\[cC])[^"])+?|\\")*?[a-zA-Z](?![^\[\]]*\]))))#"$1".(($1 =~ /"$/)?("\\\\c"):("\\c"))#ge and print STDERR "$.:$_"' *.vim~sdl.vim

        (http://bpaste.net/show/38268/ in case it gets spoiled) and it is much smaller. There are some missed things where variables are used in the pattern. I should have used vimgrep, it would be faster then constructing the above monster.

        --
        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
      • ZyX
        ... Missed one thing here: it should be ( C ):( C ) , not ( c ):( c ) -- You received this message from the vim_dev maillist. Do not top-post!
        Message 3 of 6 , Aug 5, 2012
        • 0 Attachment
          пятница, 3 августа 2012 г., 9:05:09 UTC+4 пользователь ZyX написал:
          > пятница, 3 августа 2012 г., 5:42:30 UTC+4 пользователь Shougo написал:
          >
          > > > Why don't fix the problem by explicitely using "[=!][~=][#?]" everywhere? I just always use "#" and "?" for string comparison, no matter whether it is "=~", "is" or their opposites (yes, and I never use "=="/"!=" for string comparison). All the problems should be fixed by running
          >
          > >
          >
          > > >
          >
          > >
          >
          > >
          >
          > >
          >
          > > Because, indent/vim.vim(and I think other plugins too) uses match(). This functions also uses 'ignorecase' option.
          >
          > >
          >
          > > I can't fix it easily. So I used try finally block and changed ignorecase option.
          >
          >
          >
          > Bad. I now must go and change all match(), matchstr(), matchlist() and matchend() calls at least in all of my plugins. Thanks for pointing this out.
          >
          >
          >
          > It is still not impossible to do with a perl (ir)regular expression, but if you do grep there you will see that there are not many such calls that need to be fixed. This patch (http://bpaste.net/show/38266/) was produced by
          >
          > perl -p -i -e 's#(match(?:str|list|end)?\((?:[^([,]+|\(([^(\[]+|\((?2)*\)|\[(?2)*\])|\[(?2)*\])+,\s*(?:\[(?:\\.|[^\]])+\]|('')(?=(?:(?:(?!\\[cC])[^''])+?|'''')*?(?<!\\)(?<!\\[_z])[a-zA-Z](?![^\[\]]*\]))|(")(?=(?:(?:(?!\\\\[cC])[^"])+?|\\")*?[a-zA-Z](?![^\[\]]*\]))))#"$1".(($1 =~ /"$/)?("\\\\c"):("\\c"))#ge and print STDERR "$.:$_"' *.vim~sdl.vim
          >
          >
          >
          > (http://bpaste.net/show/38268/ in case it gets spoiled) and it is much smaller. There are some missed things where variables are used in the pattern. I should have used vimgrep, it would be faster then constructing the above monster.

          Missed one thing here: it should be "("\\\\C"):("\\C")", not "("\\\\c"):("\\c")"

          --
          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
        Your message has been successfully submitted and would be delivered to recipients shortly.