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

Re: new version of matchit.vim (for vim 6.0)

Expand Messages
  • Benoit Cerrina
    ... If ... it ... Great, now here is an updated ftplugin/vim.vim to include matchit definition for ruby (its not complete but it still helps a lot) the other
    Message 1 of 9 , Nov 1, 2001
    • 0 Attachment
      > 3. Allow b:match_words = "GetMyPattern()" for context-sensitive matching
      > patterns. (E.g., for imbedded languages, depending on current syntax.)
      If
      > b:match_words does not contain any ":" characters (and is non-empty) then
      it
      > is treated as an expression to be evaluated.
      >
      Great, now here is an updated ftplugin/vim.vim to include matchit definition
      for
      ruby (its not complete but it still helps a lot) the other scripting
      languages are
      left as an exercise for the reader or for me when I use them.
      Benoit
      PS:
      there is no matchit pattern for perl and tcl and that is surprising, on the
      other hand
      I doubt it can be done for python since it doesn't use patterns to recognize
      the end of
      a block but indent.
      PPS:
      I tried to add something in the ruby pattern for here documents but since
      backreference
      are not really supported but rather emulated it cannot be done I fear
    • Hari Krishna Dara
      On Thu, 1 Nov 2001 at 12:06pm, Benji Fisher wrote:Gary Johnson wrote: I believe this is a bug in matchit.vim. I observed similar behavior in
      Message 2 of 9 , Nov 1, 2001
      • 0 Attachment
        On Thu, 1 Nov 2001 at 12:06pm, Benji Fisher wrote:

        > Gary Johnson wrote:
        > >
        > > I believe this is a bug in matchit.vim. I observed similar behavior in
        > > the matching of <>'s surrounding HTML tags. If you don't load
        > > matchit.vim, vim deletes the matching } as expected. Benji is aware of
        > > the bug and is supposed to be coming out with a new version of
        > > matchit.vim real soon now.
        >
        > In fact, I was working on it tonight. If you want to help test the
        > latest version (1.2) of matchit.vim for vim 6.0, you can get it from
        > http://sites.netscape.net/BBenjiF/vim/plugin/matchit.vim
        > (Warning: this URL is going to go away in a few weeks.)
        > I have not yet updated the docs. (The old ones are in
        > $VIMRUNTIME/macros/matchit.txt .)
        >

        I just tried d% with the new script, but I still seem to have the same
        problem. Are you sure it is fixed?

        Hari



        _________________________________________________________
        Do You Yahoo!?
        Get your free @... address at http://mail.yahoo.com
      • Gary Johnson
        ... No, it s not. I noticed this and discussed it with Benji off-list. He can explain it better than I can, but basically, vim does not provide the hooks
        Message 3 of 9 , Nov 1, 2001
        • 0 Attachment
          On Thu, Nov 01, 2001 at 02:31:34PM -0800, Hari Krishna Dara wrote:
          > On Thu, 1 Nov 2001 at 12:06pm, Benji Fisher wrote:
          >
          > > Gary Johnson wrote:
          > > >
          > > > I believe this is a bug in matchit.vim. I observed similar behavior in
          > > > the matching of <>'s surrounding HTML tags. If you don't load
          > > > matchit.vim, vim deletes the matching } as expected. Benji is aware of
          > > > the bug and is supposed to be coming out with a new version of
          > > > matchit.vim real soon now.
          > >
          > > In fact, I was working on it tonight. If you want to help test the
          > > latest version (1.2) of matchit.vim for vim 6.0, you can get it from
          > > http://sites.netscape.net/BBenjiF/vim/plugin/matchit.vim
          > > (Warning: this URL is going to go away in a few weeks.)
          > > I have not yet updated the docs. (The old ones are in
          > > $VIMRUNTIME/macros/matchit.txt .)
          > >
          >
          > I just tried d% with the new script, but I still seem to have the same
          > problem. Are you sure it is fixed?

          No, it's not. I noticed this and discussed it with Benji off-list. He
          can explain it better than I can, but basically, vim does not provide
          the hooks necessary to do this correctly within command mode, the mode
          in which matchit operates. So unless or until vim is enhanced to
          provide such hooks, you have the choice of getting the behavior you are
          used to, or using the features of matchit. You can work around it, if
          you wish, by first moving to the opening brace and deleting forward to
          the closing brace (as long as the closing brace is not the last
          character in the file).

          Gary

          --
          Gary Johnson | Agilent Technologies
          garyjohn@... | Spokane, Washington, USA
        • Benji Fisher
          ... I find that if I start on { then the whole {...} gets deleted, unless } is the last character in the buffer. If I start on the } then d% leaves
          Message 4 of 9 , Nov 2, 2001
          • 0 Attachment
            Hari Krishna Dara wrote:
            >
            > On Thu, 1 Nov 2001 at 12:06pm, Benji Fisher wrote:
            >
            > > Gary Johnson wrote:
            > > >
            > > > I believe this is a bug in matchit.vim. I observed similar behavior in
            > > > the matching of <>'s surrounding HTML tags. If you don't load
            > > > matchit.vim, vim deletes the matching } as expected. Benji is aware of
            > > > the bug and is supposed to be coming out with a new version of
            > > > matchit.vim real soon now.
            > >
            > > In fact, I was working on it tonight. If you want to help test the
            > > latest version (1.2) of matchit.vim for vim 6.0, you can get it from
            > > http://sites.netscape.net/BBenjiF/vim/plugin/matchit.vim
            > > (Warning: this URL is going to go away in a few weeks.)
            > > I have not yet updated the docs. (The old ones are in
            > > $VIMRUNTIME/macros/matchit.txt .)
            > >
            >
            > I just tried d% with the new script, but I still seem to have the same
            > problem. Are you sure it is fixed?
            >
            > Hari

            I find that if I start on "{" then the whole "{...}" gets deleted, unless
            "}" is the last character in the buffer. If I start on the "}" then "d%"
            leaves the "}" as you describe.

            If you see something different, I suspect (hope) it is because you still
            have the old version hanging around, and the new version is not actually
            getting sourced. Note that the script checks for the global variable
            loaded_matchit.

            I cannot think of a way to handle the two situations I described (and I
            have gotten no help yet from the vim-dev list). There is a work-around:
            instead of "d%", you can use "v%d". Of course, the same thing works if I
            remove the :omap's from the script. As it is, ">%" and "=%" and other
            commands work well. My question is, do you think the problem with "d%" is
            serious enough that I should remove the :omap's, so that "d%" (and also ">%"
            and ">%") uses the default meaning of "%"? I could also make it an option.

            --Benji Fisher
          • Hari Krishna Dara
            On Thu, 1 Nov 2001 at 3:28pm, Gary Johnson wrote: I just tried d% with the new script, but I still seem to have the same problem. Are you sure it
            Message 5 of 9 , Nov 2, 2001
            • 0 Attachment
              On Thu, 1 Nov 2001 at 3:28pm, Gary Johnson wrote:
              > >
              > > I just tried d% with the new script, but I still seem to have the same
              > > problem. Are you sure it is fixed?
              >
              > No, it's not. I noticed this and discussed it with Benji off-list. He
              > can explain it better than I can, but basically, vim does not provide
              > the hooks necessary to do this correctly within command mode, the mode
              > in which matchit operates. So unless or until vim is enhanced to
              > provide such hooks, you have the choice of getting the behavior you are
              > used to, or using the features of matchit. You can work around it, if
              > you wish, by first moving to the opening brace and deleting forward to
              > the closing brace (as long as the closing brace is not the last
              > character in the file).
              >
              > Gary
              >

              Are you talking about using "df" command ? This will work only if it is on
              the same line though.

              Hari



              _________________________________________________________
              Do You Yahoo!?
              Get your free @... address at http://mail.yahoo.com
            • Hari Krishna Dara
              On Fri, 2 Nov 2001 at 6:41am, Benji Fisher wrote: I just tried d% with the new script, but I still seem to have the same problem. Are you sure it
              Message 6 of 9 , Nov 2, 2001
              • 0 Attachment
                On Fri, 2 Nov 2001 at 6:41am, Benji Fisher wrote:
                > >
                > > I just tried d% with the new script, but I still seem to have the same
                > > problem. Are you sure it is fixed?
                > >
                > > Hari
                >
                > I find that if I start on "{" then the whole "{...}" gets deleted, unless
                > "}" is the last character in the buffer. If I start on the "}" then "d%"
                > leaves the "}" as you describe.
                >
                > If you see something different, I suspect (hope) it is because you still
                > have the old version hanging around, and the new version is not actually
                > getting sourced. Note that the script checks for the global variable
                > loaded_matchit.
                >
                > I cannot think of a way to handle the two situations I described (and I
                > have gotten no help yet from the vim-dev list). There is a work-around:
                > instead of "d%", you can use "v%d". Of course, the same thing works if I
                > remove the :omap's from the script. As it is, ">%" and "=%" and other
                > commands work well. My question is, do you think the problem with "d%" is
                > serious enough that I should remove the :omap's, so that "d%" (and also ">%"
                > and ">%") uses the default meaning of "%"? I could also make it an option.
                >
                > --Benji Fisher
                >

                Yes, you are correct, there is some improvement. I can reproduce the
                behavior that you described. My earlier observation could because I was in
                a wrong env. (I use different env. for regular use and for vim related
                developments). Now it may not be that inconvenient to live with this
                problem (time will prove it).

                I observed another odd behavior also. If you use d% and try to repeat it
                using the "." command, it doesn't work. You will instead be taken onto the
                ":" prompt.

                Hari



                _________________________________________________________
                Do You Yahoo!?
                Get your free @... address at http://mail.yahoo.com
              • Benji Fisher
                ... I think the suggestion was, starting on the closing brace, %d% . Another option is v%d% . ... Good point. I ll ask about this on vim-dev. --Benji Fisher
                Message 7 of 9 , Nov 2, 2001
                • 0 Attachment
                  Hari Krishna Dara wrote:
                  >
                  > On Thu, 1 Nov 2001 at 3:28pm, Gary Johnson wrote:
                  > > >
                  > > > I just tried d% with the new script, but I still seem to have the same
                  > > > problem. Are you sure it is fixed?
                  > >
                  > > No, it's not. I noticed this and discussed it with Benji off-list. He
                  > > can explain it better than I can, but basically, vim does not provide
                  > > the hooks necessary to do this correctly within command mode, the mode
                  > > in which matchit operates. So unless or until vim is enhanced to
                  > > provide such hooks, you have the choice of getting the behavior you are
                  > > used to, or using the features of matchit. You can work around it, if
                  > > you wish, by first moving to the opening brace and deleting forward to
                  > > the closing brace (as long as the closing brace is not the last
                  > > character in the file).
                  > >
                  > > Gary
                  > >
                  >
                  > Are you talking about using "df" command ? This will work only if it is on
                  > the same line though.

                  I think the suggestion was, starting on the closing brace, "%d%".
                  Another option is "v%d%".

                  > I observed another odd behavior also. If you use d% and try to repeat it
                  > using the "." command, it doesn't work. You will instead be taken onto the
                  > ":" prompt.

                  Good point. I'll ask about this on vim-dev.

                  --Benji Fisher
                • Gary Johnson
                  ... Yes, that s what I meant. I m sorry I wasn t more clear. Thanks, Benji. Gary -- Gary Johnson | Agilent Technologies
                  Message 8 of 9 , Nov 3, 2001
                  • 0 Attachment
                    On Sat, Nov 03, 2001 at 12:17:41AM -0500, Benji Fisher wrote:
                    > Hari Krishna Dara wrote:
                    > >
                    > > On Thu, 1 Nov 2001 at 3:28pm, Gary Johnson wrote:

                    > > > You can work around it, if you wish, by first moving to the
                    > > > opening brace and deleting forward to the closing brace (as long
                    > > > as the closing brace is not the last character in the file).
                    > > >
                    > > > Gary
                    > > >
                    > >
                    > > Are you talking about using "df" command ? This will work only if it is on
                    > > the same line though.
                    >
                    > I think the suggestion was, starting on the closing brace, "%d%".
                    > Another option is "v%d%".

                    Yes, that's what I meant. I'm sorry I wasn't more clear. Thanks, Benji.

                    Gary

                    --
                    Gary Johnson | Agilent Technologies
                    garyjohn@... | Spokane, Washington, USA
                  Your message has been successfully submitted and would be delivered to recipients shortly.