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

"relative" marks?

Expand Messages
  • Chris Lott
    Is there a way to set a mark (or similar) that is relative to a word? For instance, given the following text: Foo bar. Baz. And more stuff. I d like to be able
    Message 1 of 4 , May 7, 2014
    • 0 Attachment
      Is there a way to set a mark (or similar) that is relative to a word?
      For instance, given the following text:

      Foo bar. Baz.
      And more stuff.

      I'd like to be able to quickly jump to the space after "bar." even if
      the text has been changed to something like:

      Additional text. Foo bar. Baz.
      And more stuff.

      c
      --
      Chris Lott <chris@...>

      --
      --
      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.
    • Christian Brabandt
      Hi Chris! ... Not completely, but perhaps you can set tags to do it for you (not, that I know much about it). Best, Christian -- Frauen schulden keiner
      Message 2 of 4 , May 8, 2014
      • 0 Attachment
        Hi Chris!

        On Mi, 07 Mai 2014, Chris Lott wrote:

        > Is there a way to set a mark (or similar) that is relative to a word?
        > For instance, given the following text:
        >
        > Foo bar. Baz.
        > And more stuff.
        >
        > I'd like to be able to quickly jump to the space after "bar." even if
        > the text has been changed to something like:
        >
        > Additional text. Foo bar. Baz.
        > And more stuff.

        Not completely, but perhaps you can set tags to do it for you (not, that
        I know much about it).

        Best,
        Christian
        --
        Frauen schulden keiner einzigen Religion Dank für auch nur einen
        Impuls der Freiheit.
        -- Susan Brownell Anthony

        --
        --
        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.
      • John Beckett
        ... You could do a map. The following has a space after the f . ... Pressing F8 will then jump to the position of mark a, then to the first space. John -- --
        Message 3 of 4 , May 8, 2014
        • 0 Attachment
          Chris Lott wrote:
          > Is there a way to set a mark (or similar) that is relative to
          > a word? For instance, given the following text:
          >
          > Foo bar. Baz.
          > And more stuff.
          >
          > I'd like to be able to quickly jump to the space after "bar."
          > even if the text has been changed to something like:

          You could do a map. The following has a space after the "f".

          :nnoremap <F8> `af

          Pressing F8 will then jump to the position of mark a, then to
          the first space.

          John


          --
          --
          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.
        • Elijah Griffin
          ... Marks remember cursor position not relative text. Your method may work for some changes, but not all. If mark a is on line 12, column 20, and then 40
          Message 4 of 4 , May 9, 2014
          • 0 Attachment
            John Beckett wrote:
            > Chris Lott wrote:
            >> Is there a way to set a mark (or similar) that is relative to
            >> a word? For instance, given the following text:
            >> I'd like to be able to quickly jump to the space after "bar."
            >> even if the text has been changed to something like:
            > You could do a map. The following has a space after the "f".
            > :nnoremap <F8> `af
            > Pressing F8 will then jump to the position of mark a, then to
            > the first space.

            Marks remember "cursor position" not relative text. Your method
            may work for some changes, but not all. If mark a is on line 12,
            column 20, and then 40 characters with a space at the end get
            inserted at the start of line 12, the F8 mapping you have there
            will be way off.

            A tag can contain any search pattern, and might work, again,
            this will depend on the amount of editing it has to survive.
            (In real vi, a tag can contain any ex mode command, vim's have
            been tamed somewhat.) Something like this:

            :%s/bar. /&&&&/

            Would make it difficult to know where the mark should be.

            Elijah

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