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

[PATCH] Make i( and i[ text objects behave like i{

Expand Messages
  • Tom McDonald
    There s an exception to the i{ text object that ignores ignores leading whitespace before the final } character. I think it would be useful if this extended to
    Message 1 of 5 , Jun 12, 2014
    • 0 Attachment
      There's an exception to the i{ text object that ignores ignores leading whitespace before the final } character. I think it would be useful if this extended to the i( and i[ text objects as well. In particular, as a PHP developer, I run into code like this a lot:

      $foo = array(
      'one' => 'some value',
      'two' => 'some other value',
      'three' => 'yet another value',
      );

      With the current implementation, the i( object is not very useful when there is indentation before the closing ) character. Typing ci( would leave me here (cursor marked by a | character):

      $foo = array(
      |);

      This is never useful to me, and requires a great deal more effort to accomplish what I was hoping for.

      My patch extends the exception used in i{ to i( and i[ as well. While I personally don't have a use case for this behaviour in i[, I think it's easy to agree that it should behave the same way as its brackety companions.

      --
      --
      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/d/optout.
    • Tom McDonald
      Here s a recording of a demonstration of the current behaviour: https://asciinema.org/a/10129 -- -- You received this message from the vim_dev maillist. Do
      Message 2 of 5 , Jun 13, 2014
      • 0 Attachment
        Here's a recording of a demonstration of the current behaviour:

        https://asciinema.org/a/10129

        --
        --
        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/d/optout.
      • Christian Wellenbrock
        ... I agree that this change is useful and more consistent. @Tom: In the meantime you could try targets.vim [1] which supports that behavior [2]. [1]
        Message 3 of 5 , Jun 14, 2014
        • 0 Attachment
          On Friday, June 13, 2014 4:39:37 PM UTC+2, Tom McDonald wrote:
          > Here's a recording of a demonstration of the current behaviour:
          >
          > https://asciinema.org/a/10129

          I agree that this change is useful and more consistent.

          @Tom: In the meantime you could try targets.vim [1] which supports that behavior [2].

          [1] https://github.com/wellle/targets.vim
          [2] https://github.com/wellle/targets.vim/pull/75

          --
          --
          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/d/optout.
        • Tom McDonald
          ... After looking more carefully at Vim s source, I found that current_block() is only used for (), [], {}, and . I see no reason why shouldn t be
          Message 4 of 5 , Jun 16, 2014
          • 0 Attachment
            On Saturday, June 14, 2014 10:21:30 AM UTC-4, Christian Wellenbrock wrote:
            > On Friday, June 13, 2014 4:39:37 PM UTC+2, Tom McDonald wrote:
            > > Here's a recording of a demonstration of the current behaviour:
            > >
            > > https://asciinema.org/a/10129
            >
            > I agree that this change is useful and more consistent.
            >
            > @Tom: In the meantime you could try targets.vim [1] which supports that behavior [2].
            >
            > [1] https://github.com/wellle/targets.vim
            > [2] https://github.com/wellle/targets.vim/pull/75

            After looking more carefully at Vim's source, I found that current_block() is only used for (), [], {}, and <>. I see no reason why <> shouldn't be included in this behaviour, so here's an updated patch that just removes the condition entirely.

            --
            --
            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/d/optout.
          • Bram Moolenaar
            ... I can t think of a reason to have this inconsistency. So let s include this change. Would be nice to have tests for this. I m actually surprised no test
            Message 5 of 5 , Jun 17, 2014
            • 0 Attachment
              Tom McDonald wrote:

              > On Saturday, June 14, 2014 10:21:30 AM UTC-4, Christian Wellenbrock wrote:
              > > On Friday, June 13, 2014 4:39:37 PM UTC+2, Tom McDonald wrote:
              > > > Here's a recording of a demonstration of the current behaviour:
              > > >
              > > > https://asciinema.org/a/10129
              > >
              > > I agree that this change is useful and more consistent.
              > >
              > > @Tom: In the meantime you could try targets.vim [1] which supports that behavior [2].
              > >
              > > [1] https://github.com/wellle/targets.vim
              > > [2] https://github.com/wellle/targets.vim/pull/75
              >
              > After looking more carefully at Vim's source, I found that
              > current_block() is only used for (), [], {}, and <>. I see no reason
              > why <> shouldn't be included in this behaviour, so here's an updated
              > patch that just removes the condition entirely.

              I can't think of a reason to have this inconsistency. So let's include
              this change. Would be nice to have tests for this. I'm actually
              surprised no test fails because of this change.

              --
              ARTHUR: Who are you?
              TALL KNIGHT: We are the Knights Who Say "Ni"!
              BEDEVERE: No! Not the Knights Who Say "Ni"!
              "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
              \\\ an exciting new programming language -- http://www.Zimbu.org ///
              \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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