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

ANN: vim-textobj-quotes - text objects for the closest pairs of quotes of any type

Expand Messages
  • Anton Beloglazov
    Hi All, I m happy to announce a new plugin: vim-textobj-quotes - text objects for the closest pairs of quotes of any type.
    Message 1 of 5 , Apr 11, 2014
      Hi All,

      I'm happy to announce a new plugin: vim-textobj-quotes - text objects for the closest pairs of quotes of any type.

      https://github.com/beloglazov/vim-textobj-quotes

      Using only `iq` or `aq` it allows you to operate on the content of single ('), double ("), or back (`) quotes that currently surround the cursor, are in front of the cursor, or behind (in that order of preference). In other words, it jumps forward or backwards when needed to reach the quotes.

      It's easier to understand by looking at examples (the cursor is shown with |):

      1. Before: foo '1, |2, 3' bar; after pressing diq: foo '|' bar
      2. Before: foo| '1, 2, 3' bar; after pressing diq: foo '|' bar
      3. Before: foo '1, 2, 3' |bar; after pressing diq: foo '|' bar
      4. Before: foo '1, |2, 3' bar; after pressing daq: foo | bar
      5. Before: foo| '1, 2, 3' bar; after pressing daq: foo | bar
      6. Before: foo '1, 2, 3' |bar; after pressing daq: foo | bar

      The examples above are given for single quotes, the plugin works exactly the same way for double (") and back (`) quotes.

      Please let me know if you find any bugs :)

      Cheers,
      Anton Beloglazov

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • aRkadeFR
      Hello, IMHO a bit unnecessary with the builtin possible motions. I use lots of : di da etc. The only benefits would be your the example 3 and 5 on which I
      Message 2 of 5 , Apr 11, 2014
        Hello,

        IMHO a bit unnecessary with the builtin possible motions.

        I use lots of :
        di'
        da'
        etc.

        The only benefits would be your the example 3 and 5 on which I would need to
        do two successive commands.

        Am I right or there others benefits I haven't noticed?

        Thanks anyway for the plugin and the share on the mailing list :)


        On Fri, Apr 11, 2014 at 02:13:32AM -0700, Anton Beloglazov wrote:
        > Hi All,
        >
        > I'm happy to announce a new plugin: vim-textobj-quotes - text objects for the closest pairs of quotes of any type.
        >
        > https://github.com/beloglazov/vim-textobj-quotes
        >
        > Using only `iq` or `aq` it allows you to operate on the content of single ('), double ("), or back (`) quotes that currently surround the cursor, are in front of the cursor, or behind (in that order of preference). In other words, it jumps forward or backwards when needed to reach the quotes.
        >
        > It's easier to understand by looking at examples (the cursor is shown with |):
        >
        > 1. Before: foo '1, |2, 3' bar; after pressing diq: foo '|' bar
        > 2. Before: foo| '1, 2, 3' bar; after pressing diq: foo '|' bar
        > 3. Before: foo '1, 2, 3' |bar; after pressing diq: foo '|' bar
        > 4. Before: foo '1, |2, 3' bar; after pressing daq: foo | bar
        > 5. Before: foo| '1, 2, 3' bar; after pressing daq: foo | bar
        > 6. Before: foo '1, 2, 3' |bar; after pressing daq: foo | bar
        >
        > The examples above are given for single quotes, the plugin works exactly the same way for double (") and back (`) quotes.
        >
        > Please let me know if you find any bugs :)
        >
        > Cheers,
        > Anton Beloglazov
        >
        > --
        > --
        > 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
        >
        > ---
        > You received this message because you are subscribed to the Google Groups "vim_use" group.
        > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        > For more options, visit https://groups.google.com/d/optout.

        --
        --
        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

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Anton Beloglazov
        Thanks for your feedback! One major difference with the built-in text objects is that this plugin provides a single text object that handles three types of
        Message 3 of 5 , Apr 11, 2014
          Thanks for your feedback! One major difference with the built-in text objects is that this plugin provides a single text object that handles three types of quotes in a unified way, i.e., with a single key binding.

          Another difference is that this plugin supports multiple lines, for example:

          Before:

          some |text "this is
          a multiline
          string"

          After diq:

          some text "|"

          And you are right, as in examples 3 and 6 it can jump back, which the built-in text objects don't support. Please let me know if you think there are other interesting use cases :)

          Cheers,
          Anton

          On Saturday, 12 April 2014 07:21:46 UTC+10, aRkadeFR wrote:
          > Hello,
          >
          >
          >
          > IMHO a bit unnecessary with the builtin possible motions.
          >
          >
          >
          > I use lots of :
          >
          > di'
          >
          > da'
          >
          > etc.
          >
          >
          >
          > The only benefits would be your the example 3 and 5 on which I would need to
          >
          > do two successive commands.
          >
          >
          >
          > Am I right or there others benefits I haven't noticed?
          >
          >
          >
          > Thanks anyway for the plugin and the share on the mailing list :)
          >
          >
          >
          >
          >
          > On Fri, Apr 11, 2014 at 02:13:32AM -0700, Anton Beloglazov wrote:
          >
          > > Hi All,
          >
          > >
          >
          > > I'm happy to announce a new plugin: vim-textobj-quotes - text objects for the closest pairs of quotes of any type.
          >
          > >
          >
          > > https://github.com/beloglazov/vim-textobj-quotes
          >
          > >
          >
          > > Using only `iq` or `aq` it allows you to operate on the content of single ('), double ("), or back (`) quotes that currently surround the cursor, are in front of the cursor, or behind (in that order of preference). In other words, it jumps forward or backwards when needed to reach the quotes.
          >
          > >
          >
          > > It's easier to understand by looking at examples (the cursor is shown with |):
          >
          > >
          >
          > > 1. Before: foo '1, |2, 3' bar; after pressing diq: foo '|' bar
          >
          > > 2. Before: foo| '1, 2, 3' bar; after pressing diq: foo '|' bar
          >
          > > 3. Before: foo '1, 2, 3' |bar; after pressing diq: foo '|' bar
          >
          > > 4. Before: foo '1, |2, 3' bar; after pressing daq: foo | bar
          >
          > > 5. Before: foo| '1, 2, 3' bar; after pressing daq: foo | bar
          >
          > > 6. Before: foo '1, 2, 3' |bar; after pressing daq: foo | bar
          >
          > >
          >
          > > The examples above are given for single quotes, the plugin works exactly the same way for double (") and back (`) quotes.
          >
          > >
          >
          > > Please let me know if you find any bugs :)
          >
          > >
          >
          > > Cheers,
          >
          > > Anton Beloglazov
          >
          > >
          >
          > > --
          >
          > > --
          >
          > > 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
          >
          > >
          >
          > > ---
          >
          > > You received this message because you are subscribed to the Google Groups "vim_use" group.
          >
          > > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          >
          > > For more options, visit https://groups.google.com/d/optout.

          --
          --
          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

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • BPJ
          What happens if the cursor is between two different quotes on the same line like in| this example with a far away quote Will it always jump to the double
          Message 4 of 5 , Apr 12, 2014

            What happens if the cursor is between two different quotes on the same line

            'like' in| this example with a far away "quote"

            Will it always jump to the double quote to the right or is there a cutoff point where the quote to the right is considered too far away?

            Den 12 apr 2014 03:12 skrev "Anton Beloglazov" <anton.beloglazov@...>:

            >
            > Thanks for your feedback! One major difference with the built-in text objects is that this plugin provides a single text object that handles three types of quotes in a unified way, i.e., with a single key binding.
            >
            > Another difference is that this plugin supports multiple lines, for example:
            >
            > Before:
            >
            > some |text "this is
            > a multiline
            > string"
            >
            > After diq:
            >
            > some text "|"
            >
            > And you are right, as in examples 3 and 6 it can jump back, which the built-in text objects don't support. Please let me know if you think there are other interesting use cases :)
            >
            > Cheers,
            > Anton
            >
            > On Saturday, 12 April 2014 07:21:46 UTC+10, aRkadeFR  wrote:
            > > Hello,
            > >
            > >
            > >
            > > IMHO a bit unnecessary with the builtin possible motions.
            > >
            > >
            > >
            > > I use lots of :
            > >
            > > di'
            > >
            > > da'
            > >
            > > etc.
            > >
            > >
            > >
            > > The only benefits would be your the example 3 and 5 on which I would need to
            > >
            > > do two successive commands.
            > >
            > >
            > >
            > > Am I right or there others benefits I haven't noticed?
            > >
            > >
            > >
            > > Thanks anyway for the plugin and the share on the mailing list :)
            > >
            > >
            > >
            > >
            > >
            > > On Fri, Apr 11, 2014 at 02:13:32AM -0700, Anton Beloglazov wrote:
            > >
            > > > Hi All,
            > >
            > > >
            > >
            > > > I'm happy to announce a new plugin: vim-textobj-quotes - text objects for the closest pairs of quotes of any type.
            > >
            > > >
            > >
            > > > https://github.com/beloglazov/vim-textobj-quotes
            > >
            > > >
            > >
            > > > Using only `iq` or `aq` it allows you to operate on the content of single ('), double ("), or back (`) quotes that currently surround the cursor, are in front of the cursor, or behind (in that order of preference). In other words, it jumps forward or backwards when needed to reach the quotes.
            > >
            > > >
            > >
            > > > It's easier to understand by looking at examples (the cursor is shown with |):
            > >
            > > >
            > >
            > > > 1. Before: foo '1, |2, 3' bar; after pressing diq: foo '|' bar
            > >
            > > > 2. Before: foo| '1, 2, 3' bar; after pressing diq: foo '|' bar
            > >
            > > > 3. Before: foo '1, 2, 3' |bar; after pressing diq: foo '|' bar
            > >
            > > > 4. Before: foo '1, |2, 3' bar; after pressing daq: foo | bar
            > >
            > > > 5. Before: foo| '1, 2, 3' bar; after pressing daq: foo | bar
            > >
            > > > 6. Before: foo '1, 2, 3' |bar; after pressing daq: foo | bar
            > >
            > > >
            > >
            > > > The examples above are given for single quotes, the plugin works exactly the same way for double (") and back (`) quotes.
            > >
            > > >
            > >
            > > > Please let me know if you find any bugs :)
            > >
            > > >
            > >
            > > > Cheers,
            > >
            > > > Anton Beloglazov
            > >
            > > >
            > >
            > > > --
            > >
            > > > --
            > >
            > > > 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
            > >
            > > >
            > >
            > > > ---
            > >
            > > > You received this message because you are subscribed to the Google Groups "vim_use" group.
            > >
            > > > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            > >
            > > > For more options, visit https://groups.google.com/d/optout.
            >
            > --
            > --
            > 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
            >
            > ---
            > You received this message because you are subscribed to the Google Groups "vim_use" group.
            > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            > For more options, visit https://groups.google.com/d/optout.

            --
            --
            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

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Anton Beloglazov
            In a case when both pairs of quotes are on the same line with the cursor, it will always jump forward regardless of the distance. However, if the front quotes
            Message 5 of 5 , Apr 12, 2014

              In a case when both pairs of quotes are on the same line with the cursor, it will always jump forward regardless of the distance. However, if the front quotes are on the next line, it will jump back to the quotes on the same line. If both pairs of quotes are not on the same line with the cursor, it will jump forward to the quotes on the next line.

              Cheers,
              Anton

              On 12 Apr 2014 18:42, "BPJ" <bpj@...> wrote:

              What happens if the cursor is between two different quotes on the same line

              'like' in| this example with a far away "quote"

              Will it always jump to the double quote to the right or is there a cutoff point where the quote to the right is considered too far away?

              Den 12 apr 2014 03:12 skrev "Anton Beloglazov" <anton.beloglazov@...>:
              >
              > Thanks for your feedback! One major difference with the built-in text objects is that this plugin provides a single text object that handles three types of quotes in a unified way, i.e., with a single key binding.
              >
              > Another difference is that this plugin supports multiple lines, for example:
              >
              > Before:
              >
              > some |text "this is
              > a multiline
              > string"
              >
              > After diq:
              >
              > some text "|"
              >
              > And you are right, as in examples 3 and 6 it can jump back, which the built-in text objects don't support. Please let me know if you think there are other interesting use cases :)
              >
              > Cheers,
              > Anton
              >
              > On Saturday, 12 April 2014 07:21:46 UTC+10, aRkadeFR  wrote:
              > > Hello,
              > >
              > >
              > >
              > > IMHO a bit unnecessary with the builtin possible motions.
              > >
              > >
              > >
              > > I use lots of :
              > >
              > > di'
              > >
              > > da'
              > >
              > > etc.
              > >
              > >
              > >
              > > The only benefits would be your the example 3 and 5 on which I would need to
              > >
              > > do two successive commands.
              > >
              > >
              > >
              > > Am I right or there others benefits I haven't noticed?
              > >
              > >
              > >
              > > Thanks anyway for the plugin and the share on the mailing list :)
              > >
              > >
              > >
              > >
              > >
              > > On Fri, Apr 11, 2014 at 02:13:32AM -0700, Anton Beloglazov wrote:
              > >
              > > > Hi All,
              > >
              > > >
              > >
              > > > I'm happy to announce a new plugin: vim-textobj-quotes - text objects for the closest pairs of quotes of any type.
              > >
              > > >
              > >
              > > > https://github.com/beloglazov/vim-textobj-quotes
              > >
              > > >
              > >
              > > > Using only `iq` or `aq` it allows you to operate on the content of single ('), double ("), or back (`) quotes that currently surround the cursor, are in front of the cursor, or behind (in that order of preference). In other words, it jumps forward or backwards when needed to reach the quotes.
              > >
              > > >
              > >
              > > > It's easier to understand by looking at examples (the cursor is shown with |):
              > >
              > > >
              > >
              > > > 1. Before: foo '1, |2, 3' bar; after pressing diq: foo '|' bar
              > >
              > > > 2. Before: foo| '1, 2, 3' bar; after pressing diq: foo '|' bar
              > >
              > > > 3. Before: foo '1, 2, 3' |bar; after pressing diq: foo '|' bar
              > >
              > > > 4. Before: foo '1, |2, 3' bar; after pressing daq: foo | bar
              > >
              > > > 5. Before: foo| '1, 2, 3' bar; after pressing daq: foo | bar
              > >
              > > > 6. Before: foo '1, 2, 3' |bar; after pressing daq: foo | bar
              > >
              > > >
              > >
              > > > The examples above are given for single quotes, the plugin works exactly the same way for double (") and back (`) quotes.
              > >
              > > >
              > >
              > > > Please let me know if you find any bugs :)
              > >
              > > >
              > >
              > > > Cheers,
              > >
              > > > Anton Beloglazov
              > >
              > > >
              > >
              > > > --
              > >
              > > > --
              > >
              > > > 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
              > >
              > > >
              > >
              > > > ---
              > >
              > > > You received this message because you are subscribed to the Google Groups "vim_use" group.
              > >
              > > > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              > >
              > > > For more options, visit https://groups.google.com/d/optout.
              >
              > --
              > --
              > 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
              >
              > ---
              > You received this message because you are subscribed to the Google Groups "vim_use" group.
              > To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              > For more options, visit https://groups.google.com/d/optout.

              --
              --
              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

              ---
              You received this message because you are subscribed to a topic in the Google Groups "vim_use" group.
              To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/OfxZwm88uRI/unsubscribe.
              To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.

              --
              --
              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

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